concerto_template_scheduling 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/concerto_template_scheduling/application.js +1 -0
- data/app/assets/stylesheets/concerto_template_scheduling/application.css +1 -0
- data/app/controllers/concerto_template_scheduling/schedules_controller.rb +11 -0
- data/app/models/concerto_template_scheduling/schedule.rb +3 -6
- data/app/views/concerto_template_scheduling/schedules/_form.html.erb +1 -0
- data/app/views/concerto_template_scheduling/screens/_screen_link.html.erb +4 -2
- data/app/views/public_activity/concerto_template_scheduling/schedule/_create.html.erb +17 -0
- data/app/views/public_activity/concerto_template_scheduling/schedule/_destroy.html.erb +14 -0
- data/app/views/public_activity/concerto_template_scheduling/schedule/_update.html.erb +17 -0
- data/config/locales/en.yml +12 -0
- data/lib/concerto_template_scheduling/engine.rb +6 -7
- data/lib/concerto_template_scheduling/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1671432ba95646459fd39f3cd5560d32997e33c
|
4
|
+
data.tar.gz: 73973e1c52d452cd42afd07be0c61ed11987188d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f149b6f566baa2caa01da99013f38137d69e7a23325e46b3a2b9a95a14ef22e3a124ef7ffe87375a91f5108980807f91126593979c913251198ae015f276d61
|
7
|
+
data.tar.gz: 2be7e85debbf625d1c7ab4206574d06e704ab0659d662ec7df270c09b16cfbf800d122148ff4df4536e1fb2841acc2942590f344a673702532579c7619045c9e
|
@@ -60,6 +60,10 @@ module ConcertoTemplateScheduling
|
|
60
60
|
auth! :action => :update, :object => @schedule.screen
|
61
61
|
respond_to do |format|
|
62
62
|
if @schedule.save
|
63
|
+
process_notification(@schedule, {:screen_id => @schedule.screen_id, :screen_name => @schedule.screen.name,
|
64
|
+
:template_id => @schedule.template.id, :template_name => @schedule.template.name },
|
65
|
+
:key => 'concerto_template_scheduling.schedule.create', :owner => current_user, :action => 'create')
|
66
|
+
|
63
67
|
format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }
|
64
68
|
format.json { render json: @schedule, status: :created, location: @schedule }
|
65
69
|
else
|
@@ -77,6 +81,10 @@ module ConcertoTemplateScheduling
|
|
77
81
|
|
78
82
|
respond_to do |format|
|
79
83
|
if @schedule.update_attributes(schedule_params)
|
84
|
+
process_notification(@schedule, {:screen_id => @schedule.screen_id, :screen_name => @schedule.screen.name,
|
85
|
+
:template_id => @schedule.template.id, :template_name => @schedule.template.name },
|
86
|
+
:key => 'concerto_template_scheduling.schedule.update', :owner => current_user, :action => 'update')
|
87
|
+
|
80
88
|
format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }
|
81
89
|
format.json { head :no_content }
|
82
90
|
else
|
@@ -91,6 +99,9 @@ module ConcertoTemplateScheduling
|
|
91
99
|
def destroy
|
92
100
|
@schedule = Schedule.find(params[:id])
|
93
101
|
auth! :action => :update, :object => @schedule.screen
|
102
|
+
process_notification(@schedule, {:screen_id => @schedule.screen_id, :screen_name => @schedule.screen.name,
|
103
|
+
:template_id => @schedule.template.id, :template_name => @schedule.template.name },
|
104
|
+
:key => 'concerto_template_scheduling.schedule.destroy', :owner => current_user, :action => 'destroy')
|
94
105
|
@schedule.destroy
|
95
106
|
|
96
107
|
respond_to do |format|
|
@@ -1,15 +1,14 @@
|
|
1
1
|
module ConcertoTemplateScheduling
|
2
2
|
class Schedule < ActiveRecord::Base
|
3
3
|
include ActiveModel::ForbiddenAttributesProtection
|
4
|
+
include PublicActivity::Common if defined? PublicActivity::Common
|
4
5
|
|
5
6
|
DISPLAY_NEVER=0
|
6
|
-
DISPLAY_ALWAYS=1
|
7
7
|
DISPLAY_AS_SCHEDULED=2
|
8
8
|
DISPLAY_CONTENT_EXISTS=3
|
9
9
|
|
10
10
|
DISPLAY_WHEN = {
|
11
11
|
I18n.t('concerto_template_scheduling.never') => DISPLAY_NEVER,
|
12
|
-
I18n.t('concerto_template_scheduling.always') => DISPLAY_ALWAYS,
|
13
12
|
I18n.t('concerto_template_scheduling.as_scheduled') => DISPLAY_AS_SCHEDULED,
|
14
13
|
I18n.t('concerto_template_scheduling.content_exists') => DISPLAY_CONTENT_EXISTS
|
15
14
|
}
|
@@ -65,7 +64,7 @@ module ConcertoTemplateScheduling
|
|
65
64
|
# @return [Hash{String => String, Number}] configuration hash.
|
66
65
|
def default_config
|
67
66
|
{
|
68
|
-
'display_when' =>
|
67
|
+
'display_when' => DISPLAY_AS_SCHEDULED,
|
69
68
|
'from_time' => '12:00am',
|
70
69
|
'to_time' => '11:59pm'
|
71
70
|
}
|
@@ -139,9 +138,7 @@ module ConcertoTemplateScheduling
|
|
139
138
|
# and it is within the viewing window for the day
|
140
139
|
if Clock.time >= Time.parse(self.config['from_time']) && Clock.time <= Time.parse(self.config['to_time'])
|
141
140
|
# and it is either marked as always shown
|
142
|
-
if self.config['display_when'].to_i ==
|
143
|
-
effective = true
|
144
|
-
elsif self.config['display_when'].to_i == DISPLAY_CONTENT_EXISTS
|
141
|
+
if self.config['display_when'].to_i == DISPLAY_CONTENT_EXISTS
|
145
142
|
# or if we detect actual content on the specified feed
|
146
143
|
if !self.feed.nil? && !self.feed.approved_contents.active.where('kind_id != 4').empty?
|
147
144
|
effective = true
|
@@ -36,8 +36,7 @@
|
|
36
36
|
<%= l(schedule.start_time.to_date, :format => :short) %> - <%= l(schedule.end_time.to_date, :format => :short) %>
|
37
37
|
<% end %> <b><%= schedule.is_effective? ? t(:active) : '' %></b>
|
38
38
|
</p>
|
39
|
-
<p><%= schedule.config['
|
40
|
-
<p><%= t('concerto_template_scheduling.when')%>: <b><%= ConcertoTemplateScheduling::Schedule::DISPLAY_WHEN.key(schedule.config['display_when'].to_i) %></b></p>
|
39
|
+
<p><b><%= ConcertoTemplateScheduling::Schedule::DISPLAY_WHEN.key(schedule.config['display_when'].to_i) %></b></p>
|
41
40
|
|
42
41
|
<% if schedule.config['display_when'].to_i == ConcertoTemplateScheduling::Schedule::DISPLAY_CONTENT_EXISTS %>
|
43
42
|
<p>
|
@@ -50,6 +49,9 @@
|
|
50
49
|
<% elsif schedule.config['display_when'].to_i == ConcertoTemplateScheduling::Schedule::DISPLAY_AS_SCHEDULED %>
|
51
50
|
<p><%= schedule.schedule_in_words %></p>
|
52
51
|
<% end %>
|
52
|
+
<% if schedule.config['display_when'].to_i != ConcertoTemplateScheduling::Schedule::DISPLAY_NEVER %>
|
53
|
+
<p><%= schedule.config['from_time'] %> - <%= schedule.config['to_time'] %></p>
|
54
|
+
<% end %>
|
53
55
|
</div>
|
54
56
|
</li>
|
55
57
|
<% end %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<% public_owner = User.find(activity.owner) %>
|
2
|
+
<%= link_to public_owner.name, public_owner %> <%=t('.scheduled_template')%>
|
3
|
+
<% if ::Template.exists?(activity.parameters[:template_id]) %>
|
4
|
+
<%= link_to activity.parameters[:template_name], main_app.template_path(activity.parameters[:template_id]) %>
|
5
|
+
<% else %>
|
6
|
+
<%= activity.parameters[:template_name] %>
|
7
|
+
<% end %>
|
8
|
+
<% if activity.trackable && defined?(template_scheduling) %>
|
9
|
+
<%= t('concerto_template_scheduling.starting') %>
|
10
|
+
<%= link_to l(activity.trackable.start_time.to_date, :format => :short), template_scheduling.schedule_path(activity.trackable) %>
|
11
|
+
<% end %>
|
12
|
+
<%= t('concerto_template_scheduling.for') %>
|
13
|
+
<% if Screen.exists?(activity.parameters[:screen_id]) %>
|
14
|
+
<%= link_to activity.parameters[:screen_name], main_app.screen_path(activity.parameters[:screen_id]) %>
|
15
|
+
<% else %>
|
16
|
+
<%= activity.parameters[:screen_name] %>
|
17
|
+
<% end %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<% public_owner = User.find(activity.owner) %>
|
2
|
+
<%= link_to public_owner.name, public_owner %> <%=t('.deleted_a_schedule')%>
|
3
|
+
<%= t('concerto_template_scheduling.for') %>
|
4
|
+
<% if ::Template.exists?(activity.parameters[:template_id]) %>
|
5
|
+
<%= link_to activity.parameters[:template_name], main_app.template_path(activity.parameters[:template_id]) %>
|
6
|
+
<% else %>
|
7
|
+
<%= activity.parameters[:template_name] %>
|
8
|
+
<% end %>
|
9
|
+
<%= t('concerto_template_scheduling.for') %>
|
10
|
+
<% if Screen.exists?(activity.parameters[:screen_id]) %>
|
11
|
+
<%= link_to activity.parameters[:screen_name], main_app.screen_path(activity.parameters[:screen_id]) %>
|
12
|
+
<% else %>
|
13
|
+
<%= activity.parameters[:screen_name] %>
|
14
|
+
<% end %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<% public_owner = User.find(activity.owner) %>
|
2
|
+
<%= link_to public_owner.name, public_owner %> <%=t('.updated_template')%>
|
3
|
+
<% if ::Template.exists?(activity.parameters[:template_id]) %>
|
4
|
+
<%= link_to activity.parameters[:template_name], main_app.template_path(activity.parameters[:template_id]) %>
|
5
|
+
<% else %>
|
6
|
+
<%= activity.parameters[:template_name] %>
|
7
|
+
<% end %>
|
8
|
+
<% if activity.trackable && defined?(template_scheduling) %>
|
9
|
+
<%= t('concerto_template_scheduling.starting') %>
|
10
|
+
<%= link_to l(activity.trackable.start_time.to_date, :format => :short), template_scheduling.schedule_path(activity.trackable) %>
|
11
|
+
<% end %>
|
12
|
+
<%= t('concerto_template_scheduling.for') %>
|
13
|
+
<% if Screen.exists?(activity.parameters[:screen_id]) %>
|
14
|
+
<%= link_to activity.parameters[:screen_name], main_app.screen_path(activity.parameters[:screen_id]) %>
|
15
|
+
<% else %>
|
16
|
+
<%= activity.parameters[:screen_name] %>
|
17
|
+
<% end %>
|
data/config/locales/en.yml
CHANGED
@@ -20,12 +20,14 @@ en:
|
|
20
20
|
as_scheduled: 'As Scheduled'
|
21
21
|
content_exists: 'Content Exists on Feed'
|
22
22
|
effective: 'Currently in Effect? '
|
23
|
+
for: 'for'
|
23
24
|
never: 'Never'
|
24
25
|
from_time_must_precede_to_time: "'From Time' must precede 'To Time'"
|
25
26
|
must_be_selected: 'must be selected'
|
26
27
|
valid: 'Active'
|
27
28
|
when: 'When'
|
28
29
|
schedule_must_be_defined: 'Scheduling Criteria must be defined when "Use Template When" is "As Scheduled"'
|
30
|
+
starting: 'starting'
|
29
31
|
|
30
32
|
schedules:
|
31
33
|
edit:
|
@@ -60,3 +62,13 @@ en:
|
|
60
62
|
templates:
|
61
63
|
in_use_by:
|
62
64
|
scheduled_for_the_following_screens: 'Scheduled for the following screens'
|
65
|
+
|
66
|
+
public_activity:
|
67
|
+
concerto_template_scheduling:
|
68
|
+
schedule:
|
69
|
+
create:
|
70
|
+
scheduled_template: 'scheduled template '
|
71
|
+
destroy:
|
72
|
+
deleted_a_schedule: 'deleted a scheduled template '
|
73
|
+
update:
|
74
|
+
updated_template: 'updated schedule for template '
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'recurring_select'
|
1
2
|
module ConcertoTemplateScheduling
|
2
3
|
class Engine < ::Rails::Engine
|
3
4
|
isolate_namespace ConcertoTemplateScheduling
|
@@ -37,13 +38,11 @@ module ConcertoTemplateScheduling
|
|
37
38
|
|
38
39
|
# influence which template is the effective template for a screen
|
39
40
|
|
40
|
-
add_controller_hook "Screen", :
|
41
|
-
#
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
@template = schedules.first.template if !schedules.empty?
|
46
|
-
end
|
41
|
+
add_controller_hook "Screen", :frontend_display, :before do
|
42
|
+
# sets the template to the "effective" template
|
43
|
+
schedules = Schedule.active.where(:screen_id => self.id)
|
44
|
+
schedules.reject! {|s| !s.is_effective? }
|
45
|
+
self.template = schedules.first.template if !schedules.empty?
|
47
46
|
end
|
48
47
|
|
49
48
|
# delete schedules when a screen is deleted
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: concerto_template_scheduling
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marvin Frederickson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -90,6 +90,9 @@ files:
|
|
90
90
|
- app/views/concerto_template_scheduling/schedules/show.html.erb
|
91
91
|
- app/views/concerto_template_scheduling/screens/_screen_link.html.erb
|
92
92
|
- app/views/concerto_template_scheduling/templates/_in_use_by.html.erb
|
93
|
+
- app/views/public_activity/concerto_template_scheduling/schedule/_create.html.erb
|
94
|
+
- app/views/public_activity/concerto_template_scheduling/schedule/_destroy.html.erb
|
95
|
+
- app/views/public_activity/concerto_template_scheduling/schedule/_update.html.erb
|
93
96
|
- config/locales/en.yml
|
94
97
|
- config/routes.rb
|
95
98
|
- db/migrate/20140118205731_create_concerto_template_scheduling_schedules.rb
|