Skip to content

Commit e0679c2

Browse files
committed
Merge pull request #178 from cjsaylor/2.4.3
2.4.3
2 parents 1b7b3e1 + b6f022d commit e0679c2

38 files changed

Lines changed: 92 additions & 363 deletions

File tree

.htaccess

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
<IfModule mod_rewrite.c>
2-
RewriteEngine on
3-
# SEO redirect
4-
RewriteBase /
5-
RewriteCond %{HTTP_HOST} ^www.boxmeupapp.com$ [NC]
6-
RewriteRule ^(.*)$ http://boxmeupapp.com/$1 [R=301,L]
1+
RewriteEngine on
2+
# SEO redirect
3+
RewriteBase /
4+
RewriteCond %{HTTP_HOST} ^www.boxmeupapp.com$ [NC]
5+
RewriteRule ^(.*)$ http://boxmeupapp.com/$1 [R=301,L]
76

8-
RewriteRule ^$ app/webroot/ [L]
9-
RewriteRule (.*) app/webroot/$1 [L]
10-
</IfModule>
7+
RewriteRule ^$ app/webroot/ [L]
8+
RewriteRule (.*) app/webroot/$1 [L]

app/.htaccess

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
php_value newrelic.appname "Boxmeup"
22

3-
<IfModule mod_rewrite.c>
4-
RewriteEngine on
5-
RewriteBase /app/
6-
RewriteRule ^$ webroot/ [L]
7-
RewriteRule (.*) webroot/$1 [L]
8-
</IfModule>
3+
RewriteEngine on
4+
RewriteBase /app/
5+
RewriteRule ^$ webroot/ [L]
6+
RewriteRule (.*) webroot/$1 [L]

app/Config/bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
// Configure::write('Site.theme', 'default');
4848

4949
// Mobile themes
50-
Configure::write('Site.mobile_theme', Configure::read('Env.Site.mobile_theme') ?: 'mobile');
50+
Configure::write('Site.mobile_theme', Configure::read('Env.Site.mobile_theme') ?: 'Mobile');
5151
Configure::write('Site.jquery_mobile_theme', Configure::read('Env.Site.jquery_mobile_theme') ?: 'b');
5252

5353
// Analytics

app/Controller/AppController.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,7 @@ protected function checkSsl() {
125125

126126
protected function setupMobile() {
127127
if($this->isMobile()) {
128-
$this->theme = Configure::read('Site.mobile_theme') ?
129-
Configure::read('Site.mobile_theme') :
130-
'mobile';
128+
$this->theme = Configure::read('Site.mobile_theme');
131129
$this->layout = $this->RequestHandler->isAjax() && $this->isMobileDialog ? 'dialog' : 'mobile';
132130
$this->autoLayout = true;
133131
$this->autoRender = true;

app/Controller/ContainersController.php

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ class ContainersController extends AppController {
88

99
public $_secure = true;
1010

11+
public $uses = ['Container', 'Location'];
12+
1113
public function beforeFilter() {
1214
parent::beforeFilter();
1315
$this->set('active', 'containers.index');
@@ -17,7 +19,7 @@ public function dashboard() {
1719
$this->helpers[] = 'Time';
1820
$total_containers = $this->Container->getTotalContainersPerUser($this->Auth->user('id'));
1921
$total_container_items = $this->Container->getTotalContainerItemsPerUser($this->Auth->user('id'));
20-
$total_locations = ClassRegistry::init('Location')->getTotalLocationsPerUser($this->Auth->user('id'));
22+
$total_locations = $this->Location->getTotalLocationsPerUser($this->Auth->user('id'));
2123

2224
// Recent items
2325
$recent_items = $this->Container->ContainerItem->getRecentItems($this->Auth->user('id'));
@@ -40,14 +42,14 @@ public function index() {
4042
$this->Session->setFlash('Start by creating a container.', 'notification/notice');
4143
$this->redirect(array('action' => 'add'));
4244
}
43-
45+
4446
// Check the cookie and render the view depending on what was selected
45-
$location_list = ClassRegistry::init('Location')->getLocationList($this->Auth->user('id'), true);
47+
$location_list = $this->Location->getLocationList($this->Auth->user('id'), true);
4648
array_unshift($location_list, array('__UNASSIGNED__' => '-- Unassigned --'));
4749
$this->set(compact('containers', 'control', 'location_list'));
4850
$this->request->data['Location']['uuid'] = !empty($this->request->params['named']['location']) ? $this->request->params['named']['location'] : null;
4951
}
50-
52+
5153
public function change_view($view) {
5254
$this->Session->write('Feature.change_view', $view == 'list' ? 'list' : 'grid');
5355
$this->redirect($this->referer());
@@ -71,20 +73,27 @@ public function view($slug=null) {
7173
}
7274

7375
public function add() {
74-
$this->set('title_for_layout', __('Add New Container'));
76+
$location_list = $this->Location->getLocationList($this->Auth->user('id'), true);
77+
$this->set(array(
78+
'title_for_layout' => __('Add New Container'),
79+
'location_list' => $location_list
80+
));
7581
if(!empty($this->request->data)) {
7682
$this->request->data['Container']['user_id'] = $this->Auth->user('id');
77-
$results = $this->Container->save($this->request->data);
83+
if (!empty($this->request->data['Container']['location_id'])) {
84+
$this->request->data['Container']['location_id'] = $this->Location->getIdByUUID($this->request->data['Container']['location_id']);
85+
}
86+
$this->Container->set($this->request->data);
87+
$results = $this->Container->save();
7888
if($results) {
7989
$this->Session->setFlash('Successfully added new container', 'notification/success');
80-
$page = (int) ceil($this->Container->getTotalContainersPerUser($this->Auth->user('id')) / $this->Container->pagination_limit);
8190
$this->redirect(array('controller' => 'containers', 'action' => 'view', $results['Container']['slug']));
8291
} else {
8392
$this->Session->setFlash('There was a problem saving your container.', 'notification/error');
8493
}
8594
}
8695
}
87-
96+
8897
public function ajax_add($container_item_id) {
8998
$this->helpers[] = 'Time';
9099
$item = $this->Container->ContainerItem->find('first', array(
@@ -112,7 +121,7 @@ public function edit($container_uuid='') {
112121
$this->Session->setFlash(__('Unable to update the container.'), 'notification/error');
113122
}
114123
} else {
115-
$location_list = ClassRegistry::init('Location')->getLocationList($this->Auth->user('id'));
124+
$location_list = $this->Location->getLocationList($this->Auth->user('id'));
116125
$this->request->data = $this->Container->find('first', array(
117126
'conditions' => array('uuid' => $container_uuid),
118127
'contain' => array()
@@ -147,7 +156,7 @@ public function print_label($container_uuid) {
147156
'contain' => array()
148157
)));
149158
}
150-
159+
151160
public function export($container_uuid) {
152161
$this->helpers[] = 'Csv';
153162
$this->layout = false;
@@ -164,7 +173,7 @@ public function export($container_uuid) {
164173
));
165174
$this->set(compact('data'));
166175
}
167-
176+
168177
public function bulk_print() {
169178
if(!empty($this->request->data)) {
170179
$this->helpers[] = 'GChart.QR';

app/Controller/UsersController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ public function account() {
108108
if(empty($this->request->data['User']['password'])) {
109109
unset($this->request->data['User']['password']);
110110
}
111+
$this->Cookie->write('language', $this->request->data['User']['locale'], false, '1 week');
111112
if($this->User->save($this->request->data)) {
112113
$this->Session->setFlash(__('Successfully updated account settings.'), 'notification/success');
113114
$this->redirect(array('action' => 'account'));
@@ -117,6 +118,7 @@ public function account() {
117118
} else {
118119
$this->request->data['User']['email'] = $this->User->field('email', array('id' => $this->Auth->user('id')));
119120
}
121+
$this->request->data['User']['locale'] = $this->Cookie->read('language');
120122
$api_key = ClassRegistry::init('Api.ApiUser')->getApiKey($this->Auth->user('id'));
121123
$secret_key = ClassRegistry::init('Api.ApiUser')->getSecretKey($api_key);
122124
$this->set(compact('api_key', 'secret_key'));

app/View/Containers/add.ctp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66
<label for="ContainerName" class="col-lg-2"><?php echo __('Name'); ?></label>
77
<div class="col-lg-10">
88
<?php echo $this->Form->input('name', array('label' => false, 'class' => 'focus form-control')); ?>
9+
</div>
10+
</div>
11+
<div class="form-group">
12+
<label for="ContainerLocation" class="col-lg-2"><?php echo __('Location') ?></label>
13+
<div class="col-lg-10">
14+
<?php
15+
echo $this->Form->input('location_id', array('label' => false, 'options' => $location_list, 'empty' => '-- Unassigned --', 'class' => 'form-control'));
16+
?>
917
<br>
1018
<button type="submit" class="btn btn-success"><?php echo __('Add') ?></button>
1119
</div>

app/View/Elements/app/account.ctp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
</li>
1515
</ul>
1616
<?php
17-
echo $this->Form->create('Language', array('id' => 'change-language', 'url' => array('controller' => 'users', 'action' => 'change_language'), 'class' => 'navbar-form navbar-right'));
18-
echo $this->Form->input('locale', array('id' => 'change-language-locale', 'label' => false, 'div' => false, 'class' => 'form-control', 'options' => $availableLanguages, 'empty' => __('Choose Language')));
19-
echo $this->Form->end();
2017
echo $this->Form->create('Search', array('url' => array('controller' => 'searches', 'action' => 'find'), 'autocomplete' => 'off', 'class' => 'navbar-form pull-right'));
2118
echo $this->Form->input('query', array('label' => false, 'type' => 'text', 'div' => false, 'autocomplete' => 'off', 'class' => 'form-control', 'placeholder' => __('Search')));
2219
echo $this->Form->end();

app/View/Elements/app/navigation.ctp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,11 @@
5454
</a>
5555
</li>
5656
<?php endforeach ?>
57+
<li class="to-top hidden" style="border-top: 1px solid #ddd"></li>
58+
<li>
59+
<a href="#" class="to-top hidden">
60+
<i class="icon-arrow-up" style="color: #666; margin-right: 15px"></i><?php echo __('Go to Top') ?>
61+
</a>
62+
</li>
5763
</ul>
5864
</div>

app/View/Elements/nav.ctp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@
2020
</ul>
2121
<?php
2222
}
23-
echo $this->Form->create('Language', array('id' => 'change-language', 'url' => array('controller' => 'users', 'action' => 'change_language'), 'class' => 'navbar-form navbar-right'));
24-
echo $this->Form->input('locale', array('id' => 'change-language-locale', 'label' => false, 'div' => false, 'class' => 'form-control', 'options' => $availableLanguages, 'empty' => __('Choose Language'), 'style' => 'width: 200px;'));
25-
echo $this->Form->end();
2623
?>
27-
<ul class="nav navbar-nav navbar-right">
24+
<ul class="nav navbar-nav navbar-right" style="margin-right: 20px;">
2825
<li><?php echo $this->Html->link(__('Blog'), 'http://blog.boxmeupapp.com'); ?></li>
2926
</ul>

0 commit comments

Comments
 (0)