Skip to content
Permalink
Browse files

Fixed issue with clearing images and removed required validation rule…

… to make field optional
  • Loading branch information
sampoyigi committed May 31, 2016
1 parent d5d2940 commit 4f213d2a788c26605f802e61d9f073400f8600d7
@@ -153,8 +153,8 @@ public function edit() {
$data['image_name'] = basename($category_info['image']);
$data['image_url'] = $this->Image_tool_model->resize($category_info['image']);
} else {
$data['image'] = 'data/no_photo.png';
$data['image_name'] = 'no_photo.png';
$data['image'] = '';
$data['image_name'] = '';
$data['image_url'] = $data['no_image'];
}

@@ -205,7 +205,7 @@ private function validateForm() {
$this->form_validation->set_rules('permalink[permalink_id]', 'lang:label_permalink_id', 'xss_clean|trim|integer');
$this->form_validation->set_rules('permalink[slug]', 'lang:label_permalink_slug', 'xss_clean|trim|alpha_dash|max_length[255]');
$this->form_validation->set_rules('parent_id', 'lang:label_parent', 'xss_clean|trim|integer');
$this->form_validation->set_rules('image', 'lang:label_image', 'xss_clean|trim|required');
$this->form_validation->set_rules('image', 'lang:label_image', 'xss_clean|trim');
$this->form_validation->set_rules('priority', 'lang:label_priority', 'xss_clean|trim|required|integer');
$this->form_validation->set_rules('status', 'lang:label_status', 'xss_clean|trim|required|integer');

@@ -227,8 +227,8 @@ public function edit() {
$data['location_image_name'] = basename($location_info['location_image']);
$data['location_image_url'] = $this->Image_tool_model->resize($location_info['location_image']);
} else {
$data['location_image'] = 'data/no_photo.png';
$data['location_image_name'] = 'no_photo.png';
$data['location_image'] = '';
$data['location_image_name'] = '';
$data['location_image_url'] = $this->Image_tool_model->resize('data/no_photo.png');
}

@@ -572,7 +572,7 @@ private function validateForm() {
$this->form_validation->set_rules('location_status', 'lang:label_status', 'xss_clean|trim|required|integer');
$this->form_validation->set_rules('permalink[permalink_id]', 'lang:label_permalink_id', 'xss_clean|trim|integer');
$this->form_validation->set_rules('permalink[slug]', 'lang:label_permalink_slug', 'xss_clean|trim|alpha_dash|max_length[255]');
$this->form_validation->set_rules('location_image', 'lang:label_image', 'xss_clean|trim|required');
$this->form_validation->set_rules('location_image', 'lang:label_image', 'xss_clean|trim');

$this->form_validation->set_rules('opening_type', 'lang:label_opening_type', 'xss_clean|trim|required|alpha_dash|max_length[10]');
if ($this->input->post('opening_type') === 'daily' AND $this->input->post('daily_days')) {
@@ -174,8 +174,8 @@ public function edit() {
$data['image_name'] = basename($menu_info['menu_photo']);
$data['menu_image_url'] = $this->Image_tool_model->resize($menu_info['menu_photo']);
} else {
$data['menu_image'] = 'data/no_photo.png';
$data['image_name'] = 'no_photo.png';
$data['menu_image'] = '';
$data['image_name'] = '';
$data['menu_image_url'] = $this->Image_tool_model->resize('data/no_photo.png');
}

@@ -323,7 +323,7 @@ private function validateForm() {
$this->form_validation->set_rules('menu_description', 'lang:label_description', 'xss_clean|trim|min_length[2]|max_length[1028]');
$this->form_validation->set_rules('menu_price', 'lang:label_price', 'xss_clean|trim|required|numeric');
$this->form_validation->set_rules('menu_category', 'lang:label_category', 'xss_clean|trim|required|integer');
$this->form_validation->set_rules('menu_photo', 'lang:label_photo', 'xss_clean|trim|required');
$this->form_validation->set_rules('menu_photo', 'lang:label_photo', 'xss_clean|trim');
$this->form_validation->set_rules('stock_qty', 'lang:label_stock_qty', 'xss_clean|trim|required|integer');
$this->form_validation->set_rules('minimum_qty', 'lang:label_minimum_qty', 'xss_clean|trim|required|integer');
$this->form_validation->set_rules('subtract_stock', 'lang:label_subtract_stock', 'xss_clean|trim|required|integer');
@@ -68,7 +68,7 @@
<input type="hidden" name="image" value="<?php echo set_value('image', $image); ?>" id="field" />
<p>
<a id="select-image" class="btn btn-primary" onclick="mediaManager('field');"><i class="fa fa-picture-o"></i></a>
<a class="btn btn-danger" onclick="$('#thumb').attr('src', '<?php echo $no_image; ?>'); $('#field').attr('value', 'data/no_photo.png'); $(this).parent().parent().find('.name').html('no_photo.png');"><i class="fa fa-times-circle"></i></a>
<a class="btn btn-danger" onclick="$('#thumb').attr('src', '<?php echo $no_image; ?>'); $('#field').attr('value', ''); $(this).parent().parent().find('.name').html('');"><i class="fa fa-times-circle"></i></a>
</p>
</div>
</div>
@@ -160,7 +160,7 @@
<input type="hidden" name="location_image" value="<?php echo set_value('location_image', $location_image); ?>" id="field" />
<p>
<a id="select-image" class="btn btn-primary" onclick="mediaManager('field');"><i class="fa fa-picture-o"></i>&nbsp;&nbsp;<?php echo lang('text_select'); ?></a>
<a class="btn btn-danger" onclick="$('#thumb').attr('src', '<?php echo $no_location_image; ?>'); $('#field').attr('value', 'data/no_photo.png'); $(this).parent().parent().find('.name').html('no_photo.png');"><i class="fa fa-times-circle"></i>&nbsp;&nbsp;<?php echo lang('text_remove'); ?> </a>
<a class="btn btn-danger" onclick="$('#thumb').attr('src', '<?php echo $no_location_image; ?>'); $('#field').attr('value', ''); $(this).parent().parent().find('.name').html('');"><i class="fa fa-times-circle"></i>&nbsp;&nbsp;<?php echo lang('text_remove'); ?> </a>
</p>
</div>
</div>
@@ -67,7 +67,7 @@
<input type="hidden" name="menu_photo" value="<?php echo set_value('menu_photo', $menu_image); ?>" id="field" />
<p>
<a id="select-image" class="btn btn-primary" onclick="mediaManager('field');"><i class="fa fa-picture-o"></i>&nbsp;&nbsp;<?php echo lang('text_select'); ?></a>
<a class="btn btn-danger" onclick="$('#thumb').attr('src', '<?php echo $no_photo; ?>'); $('#field').attr('value', 'data/no_photo.png'); $(this).parent().parent().find('.name').html('no_photo.png');"><i class="fa fa-times-circle"></i>&nbsp;&nbsp;<?php echo lang('text_remove'); ?> </a>
<a class="btn btn-danger" onclick="$('#thumb').attr('src', '<?php echo $no_photo; ?>'); $('#field').attr('value', ''); $(this).parent().parent().find('.name').html('');"><i class="fa fa-times-circle"></i>&nbsp;&nbsp;<?php echo lang('text_remove'); ?> </a>
</p>
</div>
</div>
@@ -74,8 +74,10 @@
<div class="panel-body">
<div class="row boxes">
<div class="box-one col-xs-12 col-sm-5 col-md-5">
<img class="img-responsive pull-left" src="<?php echo $location_image; ?>">
<dl>
<?php if (!empty($location_image)) { ?>
<img class="img-responsive pull-left" src="<?php echo $location_image; ?>">
<?php } ?>
<dl <?php echo (!empty($location_image)) ? 'class="box-image"' : ''; ?>>
<dd><h4><?php echo $location_name; ?></h4></dd>
<?php if (config_item('allow_reviews') !== '1') { ?>
<dd class="text-muted">
@@ -159,7 +159,7 @@ margin-bottom: 20px;
.panel-local dd, .panel-local dt {
line-height: 1.529;
}
.panel-local .box-one dl {
.panel-local .box-one dl.box-image {
margin-left: 95px;
}
.side-bar .panel-local .box-one img {
@@ -25,7 +25,9 @@
<div class="panel-body">
<div class="row">
<div class="box-one col-xs-12 col-sm-5">
<img class="img-responsive pull-left" src="<?php echo $location['location_image']; ?>">
<?php if (!empty($location['location_image'])) { ?>
<img class="img-responsive pull-left" src="<?php echo $location['location_image']; ?>">
<?php } ?>
<dl>
<dd><h4><?php echo $location['location_name']; ?></h4></dd>
<?php if (config_item('allow_reviews') !== '1') { ?>
@@ -24,13 +24,13 @@

<div id="menu<?php echo $menu['menu_id']; ?>" class="menu-item">
<div class="menu-item-wrapper row">
<?php if ($show_menu_images === '1') { ?>
<div class="menu-thumb col-xs-2 col-sm-2 wrap-none">
<?php if ($show_menu_images === '1' AND !empty($menu['menu_photo'])) { ?>
<div class="menu-thumb col-xs-2 col-sm-2 wrap-none wrap-right">
<img class="img-responsive img-thumbnail" alt="<?php echo $menu['menu_name']; ?>" src="<?php echo $menu['menu_photo']; ?>">
</div>
<?php } ?>

<div class="menu-content <?php echo ($show_menu_images === '1') ? 'col-xs-6 col-sm-6' : 'col-xs-8'; ?>">
<div class="menu-content <?php echo ($show_menu_images === '1' AND !empty($menu['menu_photo'])) ? 'col-xs-6 col-sm-6' : 'col-xs-8'; ?> wrap-none wrap-right">
<span class="menu-name"><b><?php echo $menu['menu_name']; ?></b></span>
<span class="menu-desc small">
<?php echo $menu['menu_description']; ?>
@@ -238,7 +238,7 @@

$button_color_step = '-20';
// Button Default
$style .= ".btn-default, .panel-default, .panel-default .panel-heading, .panel-nav-tabs.panel-default .panel-heading {";
$style .= ".btn-default, .panel-default .panel-heading, .panel-nav-tabs.panel-default .panel-heading {";
if ( ! empty($button['default']['background']))
$style .= "background-color: {$button['default']['background']};";

@@ -261,7 +261,7 @@
$style .= "}";

// Button Primary
$style .= ".btn-primary, .panel-primary, .panel-primary .panel-heading, .panel-nav-tabs.panel-primary .panel-heading {";
$style .= ".btn-primary, .panel-primary .panel-heading, .panel-nav-tabs.panel-primary .panel-heading {";
if ( ! empty($button['primary']['background']))
$style .= "background-color: {$button['primary']['background']};";

@@ -291,7 +291,7 @@
$style .= "}";

// Button Success
$style .= ".btn-success, .panel-success, .panel-success .panel-heading, .panel-nav-tabs.panel-success .panel-heading {";
$style .= ".btn-success, .panel-success .panel-heading, .panel-nav-tabs.panel-success .panel-heading {";
if ( ! empty($button['success']['background']))
$style .= "background-color: {$button['success']['background']};";

@@ -314,7 +314,7 @@
$style .= "}";

// Button Danger
$style .= ".btn-danger, .panel-danger, .panel-danger .panel-heading, .panel-nav-tabs.panel-danger .panel-heading {";
$style .= ".btn-danger, .panel-danger .panel-heading, .panel-nav-tabs.panel-danger .panel-heading {";
if ( ! empty($button['danger']['background']))
$style .= "background-color: {$button['danger']['background']};";

@@ -337,7 +337,7 @@
$style .= "}";

// Button Warning
$style .= ".btn-warning, .panel-warning, .panel-warning .panel-heading, .panel-nav-tabs.panel-warning .panel-heading {";
$style .= ".btn-warning, .panel-warning .panel-heading, .panel-nav-tabs.panel-warning .panel-heading {";
if ( ! empty($button['warning']['background']))
$style .= "background-color: {$button['warning']['background']};";

@@ -360,7 +360,7 @@
$style .= "}";

// Button Info
$style .= ".btn-info, .panel-info, .panel-info .panel-heading, .panel-nav-tabs.panel-info .panel-heading {";
$style .= ".btn-info, .panel-info .panel-heading, .panel-nav-tabs.panel-info .panel-heading {";
if ( ! empty($button['info']['background']))
$style .= "background-color: {$button['info']['background']};";

@@ -144,12 +144,13 @@ public function getState() {
}

public function getImage() {
$this->CI->load->model('Image_tool_model');
$image_url = NULL;
$this->CI->load->model('Image_tool_model');
if (!empty($this->local_info['location_image'])) {
return $this->CI->Image_tool_model->resize($this->local_info['location_image'], '80', '80');
$image_url = $this->CI->Image_tool_model->resize($this->local_info['location_image'], '80', '80');
}

return $this->CI->Image_tool_model->resize('data/no_photo.png', '80', '80');
return $image_url;
}

public function getGallery() {
@@ -107,8 +107,6 @@ public function getList($filter = array()) {
if ($show_menu_images === '1') {
if ( ! empty($row['menu_photo'])) {
$menu_photo_src = $this->Image_tool_model->resize($row['menu_photo'], $menu_images_w, $menu_images_h);
} else {
$menu_photo_src = $this->Image_tool_model->resize('data/no_photo.png', $menu_images_w, $menu_images_h);
}
}

0 comments on commit 4f213d2

Please sign in to comment.
You can’t perform that action at this time.