Skip to content

Commit

Permalink
Merge branch 'release/4.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Schlaefer committed Jun 8, 2014
2 parents 006e6ff + bf0c1f8 commit 693f5c5
Show file tree
Hide file tree
Showing 33 changed files with 333 additions and 245 deletions.
9 changes: 4 additions & 5 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/*jshint node: true */
process.env.TZ = 'Europe/Berlin';

module.exports = function(grunt) {
'use strict';

Expand Down Expand Up @@ -64,6 +66,7 @@ module.exports = function(grunt) {
configs.map(function(config) {
gruntConfig[config] = require('./dev/grunt/config/' + config);
});
gruntConfig.jasmine = require('./dev/grunt/config/jasmine')(gruntConfig.requirejs.release.options);

grunt.initConfig(gruntConfig);

Expand All @@ -85,11 +88,7 @@ module.exports = function(grunt) {
]);

// test
grunt.registerTask('test:js', [
// jasmine is broken with version 0.6.x
// https://github.com/cloudchen/grunt-template-jasmine-requirejs
// 'jasmine',
'jshint']);
grunt.registerTask('test:js', ['jasmine', 'jshint']);
grunt.registerTask('test:cake', ['shell:testCake']);
grunt.registerTask('test:phpcs', ['phpcs']); // alias for `grunt phpcs`
grunt.registerTask('test:php', ['test:cake', 'phpcs']);
Expand Down
2 changes: 1 addition & 1 deletion app/Config/version.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
Configure::write('Saito.v', '4.0.0');
Configure::write('Saito.v', '4.0.1');

Configure::write('Saito.saitoHomepage', 'http://saito.siezi.com');
1 change: 0 additions & 1 deletion app/Controller/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ public function login() {

public function logout() {
$this->CurrentUser->logout();
$this->redirect('/');
}

public function register() {
Expand Down
3 changes: 3 additions & 0 deletions app/Lib/UserCategories.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ protected function _getCustom() {
// becomes
// [4 => true, 7 => '0', 13 => '13']
// with 13 => '13' trueish
if (empty($this->_user['user_category_custom'])) {
$this->_user['user_category_custom'] = [];
}
$custom = $this->_user['user_category_custom'] + $this->_categories;

// then filter for zeros to get only the user categories
Expand Down
4 changes: 4 additions & 0 deletions app/Locale/deu/LC_MESSAGES/page_titles.po
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ msgstr "Kontakt"
msgid "users/login"
msgstr "Login"

#
msgid "users/logout"
msgstr "Logout"

#
msgid "users/register"
msgstr "Registrieren"
Expand Down
4 changes: 4 additions & 0 deletions app/Locale/eng/LC_MESSAGES/page_titles.po
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ msgstr "Contact"
msgid "users/login"
msgstr "Login"

#
msgid "users/logout"
msgstr "Logout"

#
msgid "users/register"
msgstr "Register"
Expand Down
9 changes: 4 additions & 5 deletions app/Model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -484,13 +484,12 @@ public function setCategory($category) {
// set custom set
$availableCats = $this->Entry->Category->find('list');
$categories = array_intersect_key($category, $availableCats);
$newCats = array();
if (count($categories) === 0) {
throw new InvalidArgumentException();
} else {
foreach ($categories as $cat => $v) {
$newCats[$cat] = ($v === true || $v === 1 || $v === '1');
}
}
$newCats = [];
foreach ($categories as $cat => $v) {
$newCats[$cat] = ($v === true || $v === 1 || $v === '1');
}
$this->set('user_category_active', 0);
$this->set('user_category_custom', $newCats);
Expand Down
11 changes: 9 additions & 2 deletions app/Test/Case/Controller/UsersControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,15 @@ public function testLoginUserLocked() {
public function testLogout() {
$this->generate('Users');
$this->_loginUser(3);
$this->testAction('/users/logout', ['method' => 'GET']);
$this->assertRedirectedTo();
$result = $this->testAction('/users/logout',
['method' => 'GET', 'return' => 'contents']);
$this->assertTag([
'tag' => 'meta',
'attributes' => [
'http-equiv' => 'refresh',
'content' => 'regexp:/1;\s/'
]
], $result);
}

/**
Expand Down
144 changes: 54 additions & 90 deletions app/View/Elements/entry/category-chooser.ctp
Original file line number Diff line number Diff line change
@@ -1,97 +1,61 @@
<?php Stopwatch::start('category-chooser.ctp'); ?>
<div id="category-chooser" style="display: none; overflow: hidden;">
<div class="panel">
<div class="panel-content panel-form">
<?php
echo $this->Form->create(
null,
array(
'url' => array(
'controller' => 'users',
'action' => 'setcategory'
),
'style' => 'clear: none;',
)
);
?>
<div style="float:right; width: 150px; margin-left: 2em;">
<p>
<?php echo __('category_chooser_context_exp'); ?>
</p>
</div>
<div class="panel">
<div class="panel-content panel-form clearfix">
<?php
echo $this->Form->create(null, [
'url' => [
'controller' => 'users',
'action' => 'setcategory'
],
'style' => 'clear: none;',
]);
?>
<div style="float:right; width: 150px; margin-left: 2em;">
<p>
<?php echo __('category_chooser_context_exp'); ?>
</p>
</div>

<ul class="category-chooser-ul">
<li class="category-chooser-li">
<?php
/* For performance reasons we generate the html manually */
/*
echo $this->Form->checkbox('CatMeta.All',
array(
'id' => 'cb-category-chooser-all',
'style' => 'visibility: hidden;',
'value' => 1));
*/
?>
<input type="hidden" name="data[CatMeta][All]" id="cb-category-chooser-all_" value="0">
<input type="checkbox" name="data[CatMeta][All]" id="cb-category-chooser-all" style="visibility: hidden;" value="1">
<?php
/* For performance reasons we generate the html manually */
/*
echo $this->Html->link(__('All'), '/users/setcategory/all')
*/
?>
<a href="<?php echo $this->webroot; ?>users/setcategory/all"><?php echo __('All Categories'); ?></a>
<ul class="category-chooser-ul">
<li class="category-chooser-li">
<?php
/* For performance reasons we generate the html manually */
/*
echo $this->Html->link(__('All'), '/users/setcategory/all')
*/
?>
<a
href="<?php echo $this->webroot; ?>users/setcategory/all"><?php echo __('All Categories'); ?></a>

</li>
<?php foreach ($categoryChooser as $key => $title): ?>
<li class="category-chooser-li">
<?php
/* For performance reasons we generate the html manually */
/*
echo $this->Form->checkbox('CatChooser.' . $key,
array(
'onclick' => "$('#cb-category-chooser-all').removeAttr('checked')",
'checked' => isset($categoryChooserChecked[$key]),
'value' => 1));
*
*/
?>
<input type="hidden" name="data[CatChooser][<?php echo $key; ?>]" id="CatChooser<?php echo $key; ?>_" value="0">
<input type="checkbox" name="data[CatChooser][<?php echo $key; ?>]"
<?php echo (isset($categoryChooserChecked[$key])) ? 'checked="checked"' : '' ; ?>
onclick="$('#cb-category-chooser-all').removeAttr('checked')" value="1" id="CatChooser<?php echo $key; ?>">
<?php
/* For performance reasons we generate the html manually */
/*
echo $this->Html->link($title, '/users/setcategory/' . $key)
*
*/
?>
<a href="<?php echo $this->webroot; ?>users/setcategory/<?php echo $key; ?>"><?php echo $title; ?></a>
</li>
<?php foreach ($categoryChooser as $key => $title): ?>
<li class="category-chooser-li">
<?php
echo $this->Form->checkbox('CatChooser.' . $key,
array(
'onclick' => "$('#cb-category-chooser-all').removeAttr('checked')",
'checked' => isset($categoryChooserChecked[$key]),
'value' => 1));
?>
<?php
/* For performance reasons we generate the html manually */
/*
echo $this->Html->link($title, '/users/setcategory/' . $key)
*
*/
?>
<a
href="<?php echo $this->webroot; ?>users/setcategory/<?php echo $key; ?>"><?php echo $title; ?></a>

</li>
<?php endforeach; ?>
</ul>
<?php
/*
$this->Js->get('#cb-category-chooser-all')->event('click',
<<<EOF
if (this.checked) {
$('#category-chooser').find(':checkbox').attr('checked', 'checked');
} else {
$('#category-chooser').find(':checkbox').removeAttr('checked');
}
return true;
EOF
);
*/
?>
<?php echo
$this->Form->submit(__('Apply'), array(
'class' => 'btn btn-submit'))
?>
<?php echo $this->Form->end() ?>
</div>
</div>
</li>
<?php endforeach; ?>
</ul>
<?php
echo $this->Form->submit(__('Apply'), ['class' => 'btn btn-submit']);
echo $this->Form->end();
?>
</div>
</div>
</div>
<?php Stopwatch::end('category-chooser.ctp'); ?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.category-chooser-ul {
margin-bottom: 1em;
}

.category-chooser-li {
margin: 0.5em;
}
1 change: 0 additions & 1 deletion app/View/Themed/Paz/webroot/css/src/partials/_forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,3 @@ textarea, input[type=text], input[type=password], %textinput {
}
}


1 change: 1 addition & 0 deletions app/View/Themed/Paz/webroot/css/src/theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
@import "partials/_imports.scss";
@import "partials/_modules.scss";

@import "partials/_categoryChooser";
@import "partials/_forms";
@import "partials/_layout";
@import "partials/_slidetabs";
Expand Down
4 changes: 4 additions & 0 deletions app/View/Themed/Paz/webroot/css/stylesheets/night.css
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ body.headerClosed #hero-home-link { padding-top: 0.5em; padding-bottom: 0.5em; }
.shp-show-btn { display: none; }
.shp-show-btn.is-active { display: inline-block; }

.category-chooser-ul { margin-bottom: 1em; }

.category-chooser-li { margin: 0.5em; }

.input { margin: 0 0 1em; }

textarea, input[type=text], input[type=password], .markItUp textarea { outline-style: none; border-style: none; width: 100%; background: #303035; border-left: 2px solid #ffcc00; -webkit-appearance: none; border-radius: 0; }
Expand Down
4 changes: 4 additions & 0 deletions app/View/Themed/Paz/webroot/css/stylesheets/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ body.headerClosed #hero-home-link { padding-top: 0.5em; padding-bottom: 0.5em; }
.shp-show-btn { display: none; }
.shp-show-btn.is-active { display: inline-block; }

.category-chooser-ul { margin-bottom: 1em; }

.category-chooser-li { margin: 0.5em; }

.input { margin: 0 0 1em; }

textarea, input[type=text], input[type=password], .markItUp textarea { outline-style: none; border-style: none; width: 100%; background: #fbfbfb; border-left: 2px solid #a5a5a5; -webkit-appearance: none; border-radius: 0; }
Expand Down
3 changes: 0 additions & 3 deletions app/View/Tools/test_js.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
'../dev/bower_components/jasmine/lib/jasmine-core/jasmine',
'../dev/bower_components/jasmine/lib/jasmine-core/jasmine-html',
'tests/boot.js',
// jasmin extensions
'../dev/bower_components/jasmine-jquery/jasmine-jquery.js',
'../dev/bower_components/sinonjs/sinon.js',

//
'lib/jquery-ui/jquery-ui.custom.min.js',
Expand Down
9 changes: 9 additions & 0 deletions app/View/Users/logout.ctp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
// trigger for logout in JS frontend
echo $this->Html->tag('div', '', ['class' => 'users logout']);

$redirect = $this->Html->meta([
'http-equiv' => 'refresh',
'content' => '1; ' . $this->webroot
]);
$this->append('meta', $redirect);
10 changes: 10 additions & 0 deletions app/webroot/css/src/partials/_basic.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.clearfix {
&:before,
&:after {
content: " ";
display: table;
}
&:after {
clear: both;
}
}
1 change: 1 addition & 0 deletions app/webroot/css/src/static.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ $fa-font-path: "../stylesheets/font";

@import "partials/lib/_pnotify";

@import "partials/_basic";
@import "partials/_font-awesome-extend";
@import "partials/_jquery-ui";
@import "partials/_messages";
Expand Down
2 changes: 1 addition & 1 deletion app/webroot/css/stylesheets/static.css

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions app/webroot/dist/common.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions app/webroot/dist/main.min.js

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions app/webroot/js/collections/threads.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
define([
'underscore',
'backbone',
'backboneLocalStorage',
'models/thread',
'models/app',
'backboneLocalStorage',
'lib/saito/localStorageHelper'
], function(_, Backbone, Store, ThreadModel, App) {
], function(_, Backbone, ThreadModel, App) {
'use strict';

var ThreadCollection = Backbone.Collection.extend({

model: ThreadModel,

localStorage: (function() {
if (App.reqres.request('app:localStorage:available')) {
return new Store('Threads');
}
var key = App.reqres.request('app:localStorage:key', 'Threads');
return new Backbone.LocalStorage(key);
})(),

fetch: function(options) {
Expand Down
Loading

0 comments on commit 693f5c5

Please sign in to comment.