dhatu 0.1.11 → 0.1.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,72 @@
1
+ <%= form_for(@promotion_attribute, :html => {:id=>"form_promotion_attribute", :class=>"mb-0 form-horizontal", :role => "form", :method => (@promotion_attribute.new_record? ? :post : :put), :remote=>true}) do |f| %>
2
+
3
+ <div id="promotion_attribute_form_error">
4
+ <%= @promotion_attribute.errors[:base].to_sentence %>
5
+ </div>
6
+
7
+ <%= hidden_field_tag "dhatu/promotion_attribute[promotion_id]",(@promotion.try(:id) || params[:pr]) %>
8
+
9
+ <div class="form-inputs mb-30 mt-30">
10
+
11
+ <div class="row">
12
+
13
+ <!-- Name -->
14
+ <div class="col-md-6 col-xs-12">
15
+ <%= theme_form_field(@promotion_attribute, :name, form_style: "top-bottom") %>
16
+ </div>
17
+
18
+ <!-- Attribute Type -->
19
+ <div class="col-md-6 col-xs-12">
20
+ <%= theme_form_group("Data Type", required: true, error_class: "", form_style: "top-bottom") do %>
21
+ <% options_list = Dhatu::PromotionAttribute::DATA_TYPES %>
22
+ <%= f.select("data_type", options_for_select(options_list, :selected => @promotion_attribute.data_type), {:prompt=>true}, {:class => 'form-control', :name => "dhatu/promotion_attribute[data_type]"}) %>
23
+ <% end %>
24
+ </div>
25
+ </div>
26
+
27
+ <div class="row">
28
+
29
+ <!-- Display (Checkbox) -->
30
+ <div class="col-md-3 col-xs-6">
31
+ <%= theme_form_field(@promotion_attribute, :display, required: false, html_options: {type: :checkbox}, form_style: "top-bottom") %>
32
+ </div>
33
+
34
+ <!-- Mandatory (Checkbox) -->
35
+ <div class="col-md-3 col-xs-6">
36
+ <%= theme_form_field(@promotion_attribute, :mandatory, required: false, html_options: {type: :checkbox}, form_style: "top-bottom") %>
37
+ </div>
38
+
39
+ <!-- Priority -->
40
+ <div class="col-md-6 col-xs-6">
41
+ <%= theme_form_field(@promotion_attribute, :priority, required: false, html_options: {type: :number, style: "width:70px;"}, form_style: "top-bottom") %>
42
+ </div>
43
+
44
+ <!-- Values -->
45
+ <div class="col-sm-12 col-xs-12">
46
+
47
+ <% display = ["text", "integer", "date", "boolean", ""].include?(@promotion_attribute.data_type.to_s) ? 'none' : ''
48
+ display = true %>
49
+ <% @promotion_attribute.set_string_values %>
50
+
51
+ <div id="tags-input-form-group" style="display: <%= display %> ;">
52
+ <%= theme_form_field(@promotion_attribute, :values_string, "data-role": "tagsinput", label: "Data Values", html_options: {class: "kuppayam-tagsinput"}, form_style: "top-bottom") %>
53
+ </div>
54
+
55
+ </div>
56
+
57
+ </div>
58
+
59
+ </div>
60
+
61
+ <div>
62
+
63
+ <%= submit_tag("Save", :class=>"btn btn-primary pull-right ml-10") %>
64
+
65
+ <%= link_to raw("<i class='fa fa-close mr-5'></i><span>Cancel</span>"), "#", onclick: "closeGenericModal();", class: "pull-right ml-10 btn btn-white" %>
66
+
67
+ </div>
68
+ <%= clear_tag(10) %>
69
+ </div>
70
+
71
+ <% end %>
72
+
@@ -0,0 +1,72 @@
1
+ <div class="tab-content">
2
+ <div class="tab-pane active">
3
+
4
+ <div class="table-responsive">
5
+ <table class="table table-hover members-table middle-align">
6
+ <thead>
7
+ <tr>
8
+ <th style="text-align: center;width:60px">#</th>
9
+ <th style="width:200px;">Name</th>
10
+ <th style="width:200px;">Data Type</th>
11
+ <th style="text-align: center;">Values</th>
12
+ <th style="width:80px;">Status</th>
13
+ <th style="width:80px;">Priority</th>
14
+ <th style="text-align: center;" colspan="2">Actions</th>
15
+ </tr>
16
+ </thead>
17
+ <tbody>
18
+ <% @promotion_attributes = @promotion.promotion_attributes.page(@current_page).per(@per_page) %>
19
+
20
+ <% @promotion_attributes.each_with_index do |promotion_attribute, i| %>
21
+ <tr id="tr_promotion_attribute_<%= promotion_attribute.id %>">
22
+
23
+ <th scope="row" style="text-align: center;">
24
+ <% if i < 0 %>
25
+ <i class="fa fa-check text-success"></i>
26
+ <% else %>
27
+ <%= i + 1 + (@per_page.to_i * (@current_page.to_i - 1)) %>
28
+ <% end %>
29
+ </th>
30
+
31
+ <td class="promotion_attribute-name">
32
+ <strong><%= link_to promotion_attribute.name, promotion_attribute_path(promotion_attribute), remote: true %></strong><br>
33
+ <%= content_tag :span, promotion_attribute.display_data_type, style: "color:darkred;" %><br>
34
+ </td>
35
+
36
+ <td style="text-align: center;">
37
+ <% promotion_attribute.values.each do |v| %>
38
+ <span class="ml-5 label label-info"><%= v %></span>
39
+ <% end %>
40
+ </td>
41
+
42
+ <td class="hidden-sm hidden-xs"><%= display_publishable_status(promotion_attribute) %></td>
43
+
44
+ <td class="hidden-sm hidden-xs"><%= promotion_attribute.priority %></td>
45
+
46
+ <% if display_manage_links? %>
47
+ <td class="action-links hidden-sm hidden-xs" style="width:10%">
48
+ <%= display_publishable_links(promotion_attribute) %>
49
+ </td>
50
+
51
+ <td class="action-links hidden-sm hidden-xs" style="width:10%">
52
+ <%= display_manage_links(promotion_attribute, @current_user) %>
53
+ </td>
54
+ <% end %>
55
+
56
+ </tr>
57
+ <% end %>
58
+ </tbody>
59
+ </table>
60
+ </div>
61
+
62
+ <div class="row">
63
+ <div class="col-sm-12">
64
+ <%= paginate_kuppayam(@promotion_attributes) %>
65
+ </div>
66
+ </div>
67
+
68
+ </div>
69
+ </div>
70
+
71
+
72
+
@@ -0,0 +1,36 @@
1
+ <tr id="tr_promotion_attribute_<%= promotion_attribute.id %>">
2
+
3
+ <th scope="row" style="text-align: center;">
4
+ <% if i < 0 %>
5
+ <i class="fa fa-check text-success"></i>
6
+ <% else %>
7
+ <%= i + 1 + (@per_page.to_i * (@current_page.to_i - 1)) %>
8
+ <% end %>
9
+ </th>
10
+
11
+ <td class="promotion_attribute-name">
12
+ <strong><%= link_to promotion_attribute.name, promotion_attribute_path(promotion_attribute), remote: true %></strong><br>
13
+ <%= content_tag :span, promotion_attribute.display_data_type, style: "color:darkred;" %><br>
14
+ </td>
15
+
16
+ <td style="text-align: center;">
17
+ <% promotion_attribute.values.each do |v| %>
18
+ <span class="ml-5 label label-info"><%= v %></span>
19
+ <% end %>
20
+ </td>
21
+
22
+ <td class="hidden-sm hidden-xs"><%= display_publishable_status(promotion_attribute) %></td>
23
+
24
+ <td class="hidden-sm hidden-xs"><%= promotion_attribute.priority %></td>
25
+
26
+ <% if display_manage_links? %>
27
+ <td class="action-links hidden-sm hidden-xs" style="width:10%">
28
+ <%= display_publishable_links(promotion_attribute) %>
29
+ </td>
30
+
31
+ <td class="action-links hidden-sm hidden-xs" style="width:10%">
32
+ <%= display_manage_links(promotion_attribute, @current_user) %>
33
+ </td>
34
+ <% end %>
35
+
36
+ </tr>
@@ -0,0 +1,72 @@
1
+ <div id="div_promotion_attribute_show">
2
+
3
+ <div class="row m-10">
4
+ <div class="col-md-9 col-xs-12" style="border-right:1px solid #f1f1f1;">
5
+
6
+ <div class="row">
7
+ <div class="col-md-10 col-sm-6 col-xs-12">
8
+ <%= theme_panel_heading(@promotion_attribute.name) %>
9
+
10
+ <%= theme_panel_sub_heading(@promotion_attribute.display_data_type, "#") %>
11
+
12
+ <%= clear_tag(10) %>
13
+ <%= display_publishable_status(@promotion_attribute) %>
14
+
15
+ <%= clear_tag(10) %>
16
+ </div>
17
+ </div>
18
+
19
+ <div class="row mt-20">
20
+ <div class="table-responsive m-20">
21
+ <table class="table table-striped table-condensed table-bordered">
22
+ <tbody>
23
+
24
+ <tr>
25
+ <th>ID</th><td><%= @promotion_attribute.id %></td>
26
+ <th>Promotion</th><td><%= @promotion_attribute.promotion.try(:display_name) %> (<%= @promotion_attribute.try(:promotion_id) %>)</td>
27
+ </tr>
28
+
29
+ <tr>
30
+ <th>Name</th><td><%= @promotion_attribute.name %></td>
31
+ <th>Data Type</th><td><%= @promotion_attribute.display_data_type %></td>
32
+ </tr>
33
+
34
+ <tr>
35
+ <th>Status</th><td><%= display_publishable_status(@promotion_attribute) %></td>
36
+ <th>Priority</th><td><%= @promotion_attribute.priority %></td>
37
+ </tr>
38
+
39
+ <tr>
40
+ <th>Created At</th><td><%= @promotion_attribute.created_at.strftime("%m/%d/%Y - %H:%M:%S") if @promotion_attribute.created_at %></td>
41
+ <th>Updated At</th><td><%= @promotion_attribute.updated_at.strftime("%m/%d/%Y - %H:%M:%S") if @promotion_attribute.updated_at %></td>
42
+ </tr>
43
+
44
+ <tr>
45
+ <th></th><td></td>
46
+ <th></th><td></td>
47
+ </tr>
48
+
49
+ <tr>
50
+ <th>Display</th><td><%= @promotion_attribute.display? ? "Yes" : "No" %></td>
51
+ <th>Mandatory</th><td><%= @promotion_attribute.mandatory? ? "Yes" : "No" %></td>
52
+ </tr>
53
+
54
+ </tbody>
55
+ </table>
56
+ </div>
57
+ <%= clear_tag(10) %>
58
+ </div>
59
+
60
+ </div>
61
+
62
+ <% if display_manage_links? %>
63
+ <div class="col-md-3 col-xs-12">
64
+ <%= display_manage_buttons(@promotion_attribute) %>
65
+ <%= display_publishable_buttons(@promotion_attribute) %>
66
+ <%= link_to raw("<i class=\"fa fa-close mr-5\"></i> <span>Cancel</span>"), "#", onclick: "closeGenericModal();", class: "mt-100 btn btn-black btn-block" %>
67
+ </div>
68
+ <% end %>
69
+
70
+ </div>
71
+
72
+ </div>
@@ -0,0 +1,73 @@
1
+ <div class="row">
2
+
3
+ <div class="col-md-12">
4
+
5
+ <ul class="nav nav-tabs">
6
+ </ul>
7
+ <div class="tab-content">
8
+ <div class="tab-pane active">
9
+
10
+ <div id="div_promotion_attribute_action_buttons">
11
+ <div class="row">
12
+ <div class="col-md-6">
13
+
14
+ <%= theme_button('Add a Promotion Attribute', 'plus', new_promotion_attribute_path(pr: @promotion.id), classes: "pull-left", btn_type: "success") %>
15
+
16
+ <%= theme_button('Refresh', 'refresh', promotion_attributes_path(), classes: "pull-left ml-10", btn_type: "white") %>
17
+
18
+ </div>
19
+ <div class="col-md-6">
20
+ <%= search_form_kuppayam(Dhatu::PromotionAttribute, promotion_attributes_path, text: @filters[:query]) %>
21
+ </div>
22
+ </div>
23
+ </div>
24
+ <%= clear_tag(10) %>
25
+
26
+ <div id="div_promotion_attribute_index">
27
+ <%= render :partial=>"dhatu/promotion_attributes/index" %>
28
+ </div>
29
+ <%= clear_tag(10) %>
30
+
31
+ </div>
32
+ </div>
33
+
34
+ </div>
35
+
36
+ </div>
37
+
38
+
39
+ <script type="text/javascript">
40
+ $('body').on('change', '#inp_form_requires_title.iswitch.checkbox', function() {
41
+ if(this.checked) {
42
+ $("#div-label-title").show();
43
+ } else {
44
+ $("#div-label-title").hide();
45
+ }
46
+ });
47
+
48
+ $('body').on('change', '#inp_form_requires_description.iswitch.checkbox', function() {
49
+ if(this.checked) {
50
+ $("#div-label-description").show();
51
+ } else {
52
+ $("#div-label-description").hide();
53
+ }
54
+ });
55
+
56
+ $('body').on('change', '#inp_form_requires_price.iswitch.checkbox', function() {
57
+ if(this.checked) {
58
+ $("#div-label-price").show();
59
+ } else {
60
+ $("#div-label-price").hide();
61
+ }
62
+ });
63
+
64
+ $('body').on('change', '#promotion_attribute_data_type', function() {
65
+ // var dataValues = ['list_drop_down', 'list_radio_button'];
66
+ // selectedDataValue = $(this).val();
67
+ // if (jQuery.inArray(selectedDataValue, dataValues) > -1){
68
+ // $('#tags-input-form-group').show();
69
+ // } else {
70
+ // $('#tags-input-form-group').hide();
71
+ // }
72
+ });
73
+ </script>
@@ -0,0 +1,52 @@
1
+ <%= form_for(@promotion,
2
+ :url => (@promotion.new_record? ? dhatu.promotions_path : dhatu.promotion_path),
3
+ :method => (@promotion.new_record? ? :post : :put),
4
+ :remote => true,
5
+ :html => {:id=>"form_promotion", :class=>"mb-0 form-horizontal"}) do |f| %>
6
+
7
+ <div id="promotion_form_error">
8
+ <%= @promotion.errors[:base].to_sentence %>
9
+ </div>
10
+
11
+ <div class="form-inputs m-15">
12
+
13
+ <%= theme_form_field(@promotion, :title, form_style: "top-bottom", html_options: { placeholder: "e.g: Samsung Galaxy S8 Dual SIM Smartphone (64GB, Black, 5.8”) + FREE 128GB MicroSD Card"}) %>
14
+
15
+ <%= theme_form_field(@promotion, :short_description, required: false, form_style: "top-bottom", html_options: { placeholder: "e.g Dhs 2,499, Was Dhs 2,799, Save Dhs 300 (11%)" }) %>
16
+
17
+ <div class="row">
18
+ <div class="col-md-4 pl-20">
19
+ <%= theme_form_field(@promotion, :display_name, required: false, html_options: {type: :checkbox}, form_style: "top-bottom") %>
20
+ </div>
21
+ <div class="col-md-4 pl-20">
22
+ <%= theme_form_field(@promotion, :display_email, required: false, html_options: {type: :checkbox}, form_style: "top-bottom") %>
23
+ </div>
24
+ <div class="col-md-4 pl-20">
25
+ <%= theme_form_field(@promotion, :display_phone, required: false, html_options: {type: :checkbox}, form_style: "top-bottom") %>
26
+ </div>
27
+ </div>
28
+
29
+ <div class="row">
30
+ <div class="col-md-4 pl-20">
31
+ <%= theme_form_field(@promotion, :name_mandatory, required: false, html_options: {type: :checkbox}, form_style: "top-bottom") %>
32
+ </div>
33
+ <div class="col-md-4 pl-20">
34
+ <%= theme_form_field(@promotion, :email_mandatory, required: false, html_options: {type: :checkbox}, form_style: "top-bottom") %>
35
+ </div>
36
+ <div class="col-md-4 pl-20">
37
+ <%= theme_form_field(@promotion, :phone_mandatory, required: false, html_options: {type: :checkbox}, form_style: "top-bottom") %>
38
+ </div>
39
+ </div>
40
+
41
+ </div>
42
+
43
+ <div>
44
+ <%= submit_tag("Save", :class=>"btn btn-primary pull-right ml-10") %>
45
+
46
+ <%= link_to raw("<i class='fa fa-close mr-5'></i><span>Cancel</span>"), "#", onclick: "closeLargeModal();", class: "pull-right btn btn-white" %>
47
+ </div>
48
+
49
+ <%= clear_tag %>
50
+
51
+ <% end %>
52
+
@@ -0,0 +1,56 @@
1
+ <div class="table-responsive">
2
+ <table class="table table-hover members-table middle-align">
3
+ <thead>
4
+ <tr>
5
+ <th style="text-align: center;width:5%">#</th>
6
+ <th style="text-align: center;width:100px"><i class="fa fa-photo"></i></th>
7
+ <th>Title</th>
8
+ <th>Short Description</th>
9
+ <th style="width:100px;" class="hidden-sm hidden-xs">Featured</th>
10
+ <th style="width:100px;" class="hidden-sm hidden-xs">Status</th>
11
+ <% if display_manage_links? %>
12
+ <th style="text-align: center;" colspan="2" class="hidden-sm hidden-xs">Actions</th>
13
+ <% end %>
14
+ </tr>
15
+ </thead>
16
+ <tbody>
17
+ <tr id="tr_promotion_0"></tr>
18
+ <% @promotions.each_with_index do |promotion, i| %>
19
+ <tr id="tr_promotion_<%= promotion.id %>">
20
+
21
+ <th scope="row" style="text-align: center;">
22
+ <%= serial_number(i) %>
23
+ </th>
24
+
25
+ <td class="display-image">
26
+ <%= display_thumbnail_small(promotion) %>
27
+ </td>
28
+
29
+ <td class="display-link"><%= link_to promotion.title, promotion_path(promotion), remote: true %></td>
30
+
31
+ <td class="display-link"><%= link_to truncate(promotion.short_description, length: 40), promotion_path(promotion), remote: true %></td>
32
+
33
+ <td class="hidden-sm hidden-xs"><%= display_featured(promotion) %></td>
34
+
35
+ <td class="hidden-sm hidden-xs"><%= display_publishable_status(promotion) %></td>
36
+
37
+ <% if display_manage_links? %>
38
+ <td class="action-links hidden-sm hidden-xs" style="width:10%"><%= display_publishable_links(promotion) %></td>
39
+
40
+ <td class="action-links hidden-sm hidden-xs" style="width:10%">
41
+ <%= display_featurable_links(promotion) %>
42
+ <%= display_manage_links(promotion, @current_user) %>
43
+ </td>
44
+ <% end %>
45
+
46
+ </tr>
47
+ <% end %>
48
+ </tbody>
49
+ </table>
50
+ </div>
51
+
52
+ <div class="row">
53
+ <div class="col-sm-12">
54
+ <%= paginate_kuppayam(@promotions) %>
55
+ </div>
56
+ </div>
@@ -0,0 +1,28 @@
1
+ <tr id="tr_promotion_<%= promotion.id %>">
2
+
3
+ <th scope="row" style="text-align: center;">
4
+ <%= serial_number(i) %>
5
+ </th>
6
+
7
+ <td class="display-image">
8
+ <%= display_thumbnail_small(promotion) %>
9
+ </td>
10
+
11
+ <td class="display-link"><%= link_to promotion.title, promotion_path(promotion), remote: true %></td>
12
+
13
+ <td class="display-link"><%= link_to truncate(promotion.short_description, length: 40), promotion_path(promotion), remote: true %></td>
14
+
15
+ <td class="hidden-sm hidden-xs"><%= display_featured(promotion) %></td>
16
+
17
+ <td class="hidden-sm hidden-xs"><%= display_publishable_status(promotion) %></td>
18
+
19
+ <% if display_manage_links? %>
20
+ <td class="action-links hidden-sm hidden-xs" style="width:10%"><%= display_publishable_links(promotion) %></td>
21
+
22
+ <td class="action-links hidden-sm hidden-xs" style="width:10%">
23
+ <%= display_featurable_links(promotion) %>
24
+ <%= display_manage_links(promotion, @current_user) %>
25
+ </td>
26
+ <% end %>
27
+
28
+ </tr>