dhatu 0.1.11 → 0.1.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/dhatu/promotion_attributes_controller.rb +108 -0
- data/app/controllers/dhatu/promotions_controller.rb +87 -0
- data/app/controllers/dhatu/resource_controller.rb +5 -0
- data/app/models/dhatu/promotion.rb +73 -0
- data/app/models/dhatu/promotion_attribute.rb +62 -0
- data/app/models/dhatu/promotion_enquiry.rb +56 -0
- data/app/views/dhatu/dashboard/_index.html.erb +24 -0
- data/app/views/dhatu/promotion_attributes/_form.html.erb +72 -0
- data/app/views/dhatu/promotion_attributes/_index.html.erb +72 -0
- data/app/views/dhatu/promotion_attributes/_row.html.erb +36 -0
- data/app/views/dhatu/promotion_attributes/_show.html.erb +72 -0
- data/app/views/dhatu/promotion_attributes/index.html.erb +73 -0
- data/app/views/dhatu/promotions/_form.html.erb +52 -0
- data/app/views/dhatu/promotions/_index.html.erb +56 -0
- data/app/views/dhatu/promotions/_row.html.erb +28 -0
- data/app/views/dhatu/promotions/_show.html.erb +148 -0
- data/app/views/dhatu/promotions/index.html.erb +46 -0
- data/app/views/layouts/kuppayam/_sidebar.html.erb +25 -1
- data/config/routes.rb +22 -0
- data/lib/dhatu/version.rb +1 -1
- data/spec/dummy/spec/factories/promotion.rb +48 -0
- data/spec/dummy/spec/factories/promotion_attributes.rb +36 -0
- data/spec/dummy/spec/factories/promotion_cover_image.rb +13 -0
- metadata +21 -3
@@ -0,0 +1,148 @@
|
|
1
|
+
<div id="div_promotion_show">
|
2
|
+
|
3
|
+
<div class="row">
|
4
|
+
|
5
|
+
<div class="col-md-3 col-sm-12 col-xs-12" style="border-right:1px solid #f1f1f1;">
|
6
|
+
<% if display_edit_links? %>
|
7
|
+
<%= edit_image(@promotion,
|
8
|
+
"cover_image.image.large.url",
|
9
|
+
upload_image_link(@promotion, :cover_image, nil ),
|
10
|
+
remove_image_link(@promotion, :cover_image, nil ),
|
11
|
+
image_options: {assoc_name: :cover_image }) %>
|
12
|
+
<% else %>
|
13
|
+
<%= display_image(@promotion, "cover_image.image.large.url", class: "img-inline", alt: @promotion.display_name) %>
|
14
|
+
<% end %>
|
15
|
+
</div>
|
16
|
+
|
17
|
+
<div class="col-md-6 col-sm-12 col-xs-12" style="border-right:1px solid #f1f1f1;">
|
18
|
+
|
19
|
+
<%= theme_panel_heading(@promotion.title) %>
|
20
|
+
|
21
|
+
<%= theme_panel_sub_heading(@promotion.short_description, "#") if @promotion.short_description %>
|
22
|
+
|
23
|
+
<%= clear_tag(10) %>
|
24
|
+
|
25
|
+
<%= display_publishable_status(@promotion) %>
|
26
|
+
|
27
|
+
<%= display_featured(@promotion) %>
|
28
|
+
|
29
|
+
<%= clear_tag(20) %>
|
30
|
+
|
31
|
+
<table class="table table-condensed table-bordered mb-20">
|
32
|
+
<tbody>
|
33
|
+
|
34
|
+
<tr>
|
35
|
+
<th>Display Name</th>
|
36
|
+
<td><%= @promotion.display_name ? "Yes" : "No" %></td>
|
37
|
+
<th>Name Mandatory?</th>
|
38
|
+
<td><%= @promotion.name_mandatory ? "Yes" : "No" %></td>
|
39
|
+
</tr>
|
40
|
+
|
41
|
+
<tr>
|
42
|
+
<th>Display Email</th>
|
43
|
+
<td><%= @promotion.display_email ? "Yes" : "No" %></td>
|
44
|
+
<th>Email Mandatory?</th>
|
45
|
+
<td><%= @promotion.email_mandatory ? "Yes" : "No" %></td>
|
46
|
+
</tr>
|
47
|
+
|
48
|
+
<tr>
|
49
|
+
<th>Display Phone</th>
|
50
|
+
<td><%= @promotion.display_phone ? "Yes" : "No" %></td>
|
51
|
+
<th>Phone Mandatory?</th>
|
52
|
+
<td><%= @promotion.phone_mandatory ? "Yes" : "No" %></td>
|
53
|
+
</tr>
|
54
|
+
|
55
|
+
</tbody>
|
56
|
+
</table>
|
57
|
+
</div>
|
58
|
+
|
59
|
+
<% if display_manage_links? %>
|
60
|
+
<div class="col-md-3 col-sm-12 col-xs-12">
|
61
|
+
<%= display_manage_buttons(@promotion) %>
|
62
|
+
<%= display_publishable_buttons(@promotion) %>
|
63
|
+
<%= display_featurable_buttons(@promotion) %>
|
64
|
+
</div>
|
65
|
+
<% end %>
|
66
|
+
|
67
|
+
</div>
|
68
|
+
|
69
|
+
<hr>
|
70
|
+
|
71
|
+
<div class="visible-sm visible-xs mb-50"></div>
|
72
|
+
|
73
|
+
<%= clear_tag(20) %>
|
74
|
+
|
75
|
+
<ul class="nav nav-pills">
|
76
|
+
<li class="active">
|
77
|
+
<a href="#technical_details" data-toggle="tab" aria-expanded="false">
|
78
|
+
<span class="visible-xs"><i class="fa-database"></i></span>
|
79
|
+
<span class="hidden-xs">Technical Details</span>
|
80
|
+
</a>
|
81
|
+
</li>
|
82
|
+
|
83
|
+
<li class="">
|
84
|
+
<a href="#additional_attributes" data-toggle="tab" aria-expanded="false">
|
85
|
+
<span class="visible-xs"><i class="fa-database"></i></span>
|
86
|
+
<span class="hidden-xs">Additional Attributes</span>
|
87
|
+
</a>
|
88
|
+
</li>
|
89
|
+
</ul>
|
90
|
+
|
91
|
+
<div class="tab-content">
|
92
|
+
<div class="tab-pane active" id="technical_details" style="border: 1px solid #000;min-height:200px;padding:20px;margin-bottom:20px;max-height: 400px;overflow-y: auto;">
|
93
|
+
|
94
|
+
<%= clear_tag(20) %>
|
95
|
+
|
96
|
+
<div class="table-responsive">
|
97
|
+
<table class="table table-striped table-condensed table-bordered mb-60">
|
98
|
+
<tbody>
|
99
|
+
|
100
|
+
<tr>
|
101
|
+
<th>ID</th><td><%= @promotion.id %></td>
|
102
|
+
<th>Code</th><td><%= @promotion.code %></td>
|
103
|
+
</tr>
|
104
|
+
<tr>
|
105
|
+
<th>Featured</th><td><%= @promotion.featured %></td>
|
106
|
+
<th>Status</th><td><%= @promotion.status %></td>
|
107
|
+
</tr>
|
108
|
+
<tr>
|
109
|
+
<th>Created At</th><td><%= @promotion.created_at.strftime("%m/%d/%Y - %H:%M:%S") if @promotion.created_at %></td>
|
110
|
+
<th>Updated At</th><td><%= @promotion.updated_at.strftime("%m/%d/%Y - %H:%M:%S") if @promotion.updated_at %></td>
|
111
|
+
</tr>
|
112
|
+
|
113
|
+
</tbody>
|
114
|
+
</table>
|
115
|
+
</div>
|
116
|
+
|
117
|
+
</div>
|
118
|
+
|
119
|
+
<div class="tab-pane" id="additional_attributes" style="border: 1px solid #000;min-height:200px;padding:20px;margin-bottom:20px;max-height: 400px;overflow-y: auto;">
|
120
|
+
|
121
|
+
<%= clear_tag(20) %>
|
122
|
+
|
123
|
+
<div id="div_promotion_attribute_action_buttons">
|
124
|
+
<div class="row">
|
125
|
+
<div class="col-md-6">
|
126
|
+
|
127
|
+
<%= theme_button('Add a Promotion Attribute', 'plus', new_promotion_attribute_path(pr: @promotion.id), classes: "pull-left", btn_type: "success") %>
|
128
|
+
|
129
|
+
<%= theme_button('Refresh', 'refresh', promotion_attributes_path(pr: @promotion.id), classes: "pull-left ml-10", btn_type: "white") %>
|
130
|
+
|
131
|
+
</div>
|
132
|
+
<div class="col-md-6"></div>
|
133
|
+
</div>
|
134
|
+
</div>
|
135
|
+
<%= clear_tag(10) %>
|
136
|
+
|
137
|
+
<div id="div_promotion_attribute_index">
|
138
|
+
<%= render :partial=>"dhatu/promotion_attributes/index" %>
|
139
|
+
</div>
|
140
|
+
<%= clear_tag(10) %>
|
141
|
+
</div>
|
142
|
+
</div>
|
143
|
+
|
144
|
+
<%= link_to "Close", "#", onclick: "closeLargeModal();", class: "btn btn-primary pull-right" %>
|
145
|
+
|
146
|
+
<%= clear_tag %>
|
147
|
+
|
148
|
+
</div>
|
@@ -0,0 +1,46 @@
|
|
1
|
+
<div class="row">
|
2
|
+
|
3
|
+
<div class="col-md-12">
|
4
|
+
|
5
|
+
<ul class="nav nav-tabs nav-tabs-justified">
|
6
|
+
<% Dhatu::Promotion::STATUS.each do |key, value| %>
|
7
|
+
<li class="<%= @status == value ? 'active' : '' %>">
|
8
|
+
<%= link_to promotions_path(st: value), "aria-expanded" => "#{ @status == value ? 'true' : 'false' }" do %>
|
9
|
+
<span class="visible-xs"><i class="fa-gift"></i></span>
|
10
|
+
<span class="hidden-xs"><%= key %></span>
|
11
|
+
<% end %>
|
12
|
+
</li>
|
13
|
+
<% end %>
|
14
|
+
</ul>
|
15
|
+
|
16
|
+
<div class="tab-content">
|
17
|
+
<div class="tab-pane active">
|
18
|
+
|
19
|
+
<div id="div_promotion_action_buttons">
|
20
|
+
|
21
|
+
<div class="row">
|
22
|
+
<div class="col-sm-6">
|
23
|
+
<%= theme_button('Add a Promotion', 'plus', new_promotion_path(), classes: "pull-left mr-10", btn_type: "success") if @current_user.has_create_permission?(Dhatu::Promotion) %>
|
24
|
+
|
25
|
+
<%= theme_button('Refresh', 'refresh', promotions_path(st: @status), classes: "pull-left mr-10", btn_type: "white") %>
|
26
|
+
</div>
|
27
|
+
<div class="col-sm-6">
|
28
|
+
<%= search_form_kuppayam(Dhatu::Promotion, promotions_path(st: @status), text: @filters[:query]) %>
|
29
|
+
</div>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
</div>
|
33
|
+
<%= clear_tag(10) %>
|
34
|
+
|
35
|
+
<div id="div_promotion_index">
|
36
|
+
<%= render :partial=>"dhatu/promotions/index" %>
|
37
|
+
</div>
|
38
|
+
<%= clear_tag(10) %>
|
39
|
+
|
40
|
+
</div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
</div>
|
44
|
+
|
45
|
+
</div>
|
46
|
+
|
@@ -1,5 +1,17 @@
|
|
1
1
|
<%
|
2
2
|
dhatu_items = {
|
3
|
+
promotions: {
|
4
|
+
text: "Promotions",
|
5
|
+
icon_class: "fa-gift",
|
6
|
+
url: dhatu.promotions_url,
|
7
|
+
has_permission: @current_user.has_read_permission?(Dhatu::Promotion)
|
8
|
+
},
|
9
|
+
promotion_enquiries: {
|
10
|
+
text: "Promotional Enquiries",
|
11
|
+
icon_class: "linecons-sound",
|
12
|
+
url: dhatu.promotion_enquiries_url,
|
13
|
+
has_permission: @current_user.has_read_permission?(Dhatu::PromotionEnquiry)
|
14
|
+
},
|
3
15
|
bookings: {
|
4
16
|
text: "Bookings",
|
5
17
|
icon_class: "fa-calendar",
|
@@ -103,6 +115,18 @@
|
|
103
115
|
icon_class: "linecons-diamond",
|
104
116
|
url: usman.features_url,
|
105
117
|
has_permission: @current_user.has_read_permission?(Feature)
|
118
|
+
},
|
119
|
+
section_types: {
|
120
|
+
text: "Manage Section Types",
|
121
|
+
icon_class: "fa-reorder",
|
122
|
+
url: dhatu.section_types_url,
|
123
|
+
has_permission: @current_user.has_read_permission?(Dhatu::SectionType)
|
124
|
+
},
|
125
|
+
promotion_attributes: {
|
126
|
+
text: "Promotion Attributes",
|
127
|
+
icon_class: "fa-list",
|
128
|
+
url: dhatu.promotion_attributes_url,
|
129
|
+
has_permission: @current_user.has_read_permission?(Dhatu::PromotionAttribute)
|
106
130
|
}
|
107
131
|
}
|
108
132
|
%>
|
@@ -200,7 +224,7 @@
|
|
200
224
|
</ul>
|
201
225
|
</li>
|
202
226
|
<% end %>
|
203
|
-
|
227
|
+
|
204
228
|
<% if configuration_items.map{|x,y| x if y[:has_permission] }.compact.any? %>
|
205
229
|
<li class="">
|
206
230
|
<a href="#">
|
data/config/routes.rb
CHANGED
@@ -4,6 +4,28 @@ Dhatu::Engine.routes.draw do
|
|
4
4
|
|
5
5
|
scope :admin do
|
6
6
|
|
7
|
+
resources :promotions do
|
8
|
+
member do
|
9
|
+
put :update_status, as: :update_status
|
10
|
+
put :mark_as_featured
|
11
|
+
put :remove_from_featured
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
resources :promotion_attributes do
|
16
|
+
member do
|
17
|
+
put :update_status, as: :update_status
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
resources :promotion_enquiries, only: [:index, :show] do
|
22
|
+
member do
|
23
|
+
put :update_status, as: :update_status
|
24
|
+
put :mark_as_featured
|
25
|
+
put :remove_from_featured
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
7
29
|
resources :bookings, only: [:index, :show] do
|
8
30
|
member do
|
9
31
|
put :update_status, as: :update_status
|
data/lib/dhatu/version.rb
CHANGED
@@ -0,0 +1,48 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
|
3
|
+
factory :unpublished_promotion, class: Dhatu::Promotion do
|
4
|
+
title "Offer Title"
|
5
|
+
code "108273"
|
6
|
+
short_description "Some Promotion Description"
|
7
|
+
|
8
|
+
display_name true
|
9
|
+
display_email true
|
10
|
+
display_phone true
|
11
|
+
|
12
|
+
name_mandatory true
|
13
|
+
email_mandatory false
|
14
|
+
phone_mandatory false
|
15
|
+
end
|
16
|
+
|
17
|
+
factory :published_promotion, parent: :unpublished_promotion do
|
18
|
+
after :build do |e|
|
19
|
+
e.publish
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
factory :removed_promotion, parent: :unpublished_promotion do
|
24
|
+
after :build do |e|
|
25
|
+
e.remove
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
factory :archived_promotion, parent: :unpublished_promotion do
|
30
|
+
after :build do |e|
|
31
|
+
e.archive
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
factory :featured_promotion, parent: :published_promotion do
|
36
|
+
after :build do |e|
|
37
|
+
e.mark_as_featured
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
factory :non_featured_promotion, parent: :published_promotion do
|
42
|
+
after :build do |e|
|
43
|
+
e.remove_from_featured
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :promotion_attribute do
|
3
|
+
name "Attribute Name"
|
4
|
+
|
5
|
+
# Data Type could be text, integer, date, list_drop_down (Select from a List), list_radio_button (Choose one) & boolean (Checkbox)
|
6
|
+
data_type "text"
|
7
|
+
mandatory false
|
8
|
+
promotion
|
9
|
+
end
|
10
|
+
|
11
|
+
factory :text_promotion_attribute, parent: :promotion_attribute do
|
12
|
+
data_type "text"
|
13
|
+
end
|
14
|
+
|
15
|
+
factory :integer_promotion_attribute, parent: :promotion_attribute do
|
16
|
+
data_type "integer"
|
17
|
+
end
|
18
|
+
|
19
|
+
factory :date_promotion_attribute, parent: :promotion_attribute do
|
20
|
+
data_type "date"
|
21
|
+
end
|
22
|
+
|
23
|
+
factory :list_drop_down_promotion_attribute, parent: :promotion_attribute do
|
24
|
+
data_type "list_drop_down"
|
25
|
+
values ["Value 1", "Value 2", "Value 3"]
|
26
|
+
end
|
27
|
+
|
28
|
+
factory :list_radio_button_promotion_attribute, parent: :promotion_attribute do
|
29
|
+
data_type "list_radio_button"
|
30
|
+
values ["Radio 1", "Radio 2", "Radio 3"]
|
31
|
+
end
|
32
|
+
|
33
|
+
factory :boolean_promotion_attribute, parent: :promotion_attribute do
|
34
|
+
data_type "boolean"
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
|
3
|
+
factory :promotion_cover_image, class: Image::CoverImage do
|
4
|
+
image { Rack::Test::UploadedFile.new('spec/dummy/spec/factories/test.jpg', 'image.png') }
|
5
|
+
association :imageable, factory: :published_promotion
|
6
|
+
end
|
7
|
+
|
8
|
+
factory :oversized_promotion_cover_image, class: Image::CoverImage do
|
9
|
+
image { Rack::Test::UploadedFile.new('spec/dummy/spec/factories/test.jpg', 'image.png') }
|
10
|
+
association :imageable, factory: :published_promotion
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dhatu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kpvarma
|
@@ -107,7 +107,7 @@ dependencies:
|
|
107
107
|
version: '0.1'
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.1.
|
110
|
+
version: 0.1.28
|
111
111
|
type: :runtime
|
112
112
|
prerelease: false
|
113
113
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -117,7 +117,7 @@ dependencies:
|
|
117
117
|
version: '0.1'
|
118
118
|
- - ">="
|
119
119
|
- !ruby/object:Gem::Version
|
120
|
-
version: 0.1.
|
120
|
+
version: 0.1.28
|
121
121
|
- !ruby/object:Gem::Dependency
|
122
122
|
name: pattana
|
123
123
|
requirement: !ruby/object:Gem::Requirement
|
@@ -418,6 +418,8 @@ files:
|
|
418
418
|
- app/controllers/dhatu/events_controller.rb
|
419
419
|
- app/controllers/dhatu/offers_controller.rb
|
420
420
|
- app/controllers/dhatu/prices_controller.rb
|
421
|
+
- app/controllers/dhatu/promotion_attributes_controller.rb
|
422
|
+
- app/controllers/dhatu/promotions_controller.rb
|
421
423
|
- app/controllers/dhatu/resource_controller.rb
|
422
424
|
- app/controllers/dhatu/section_types_controller.rb
|
423
425
|
- app/controllers/dhatu/sections_controller.rb
|
@@ -435,6 +437,9 @@ files:
|
|
435
437
|
- app/models/dhatu/event.rb
|
436
438
|
- app/models/dhatu/offer.rb
|
437
439
|
- app/models/dhatu/price.rb
|
440
|
+
- app/models/dhatu/promotion.rb
|
441
|
+
- app/models/dhatu/promotion_attribute.rb
|
442
|
+
- app/models/dhatu/promotion_enquiry.rb
|
438
443
|
- app/models/dhatu/section.rb
|
439
444
|
- app/models/dhatu/section_type.rb
|
440
445
|
- app/models/dhatu/service.rb
|
@@ -479,6 +484,16 @@ files:
|
|
479
484
|
- app/views/dhatu/prices/_row.html.erb
|
480
485
|
- app/views/dhatu/prices/_show.html.erb
|
481
486
|
- app/views/dhatu/prices/index.html.erb
|
487
|
+
- app/views/dhatu/promotion_attributes/_form.html.erb
|
488
|
+
- app/views/dhatu/promotion_attributes/_index.html.erb
|
489
|
+
- app/views/dhatu/promotion_attributes/_row.html.erb
|
490
|
+
- app/views/dhatu/promotion_attributes/_show.html.erb
|
491
|
+
- app/views/dhatu/promotion_attributes/index.html.erb
|
492
|
+
- app/views/dhatu/promotions/_form.html.erb
|
493
|
+
- app/views/dhatu/promotions/_index.html.erb
|
494
|
+
- app/views/dhatu/promotions/_row.html.erb
|
495
|
+
- app/views/dhatu/promotions/_show.html.erb
|
496
|
+
- app/views/dhatu/promotions/index.html.erb
|
482
497
|
- app/views/dhatu/section_types/_form.html.erb
|
483
498
|
- app/views/dhatu/section_types/_index.html.erb
|
484
499
|
- app/views/dhatu/section_types/_row.html.erb
|
@@ -529,6 +544,9 @@ files:
|
|
529
544
|
- spec/dummy/spec/factories/offer.rb
|
530
545
|
- spec/dummy/spec/factories/offer_cover_image.rb
|
531
546
|
- spec/dummy/spec/factories/offer_gallery_image.rb
|
547
|
+
- spec/dummy/spec/factories/promotion.rb
|
548
|
+
- spec/dummy/spec/factories/promotion_attributes.rb
|
549
|
+
- spec/dummy/spec/factories/promotion_cover_image.rb
|
532
550
|
- spec/dummy/spec/factories/section.rb
|
533
551
|
- spec/dummy/spec/factories/section_cover_image.rb
|
534
552
|
- spec/dummy/spec/factories/section_gallery_image.rb
|