concerto_hardware 0.3 → 0.4
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_hardware/players.js +8 -0
- data/app/controllers/concerto_hardware/players_controller.rb +1 -1
- data/app/models/concerto_hardware/player.rb +14 -0
- data/app/views/concerto_hardware/players/_form.html.erb +10 -0
- data/config/locales/en.yml +2 -0
- data/lib/concerto_hardware/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60218790f815f50493889a41f7159684350b2832
|
4
|
+
data.tar.gz: 59f19eff655c4ab07161be98783b3aec94ce2fb0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 363b0240ff7675c4ca9a5652fc0e46b4fa4dc1b512cd783cca2a320e519b2d6249a487111edabe9038d9fabc242c1f3fb5fb49caadb056f31362d757cbd74df6
|
7
|
+
data.tar.gz: a053a3a1ad62e64d49df6f002f5e561db33f926b3ab489d12870d885c363ccbed37aa468a073080aba71dd43ff1c711519c01df2f0f181a6e772b07e93c98474
|
@@ -12,12 +12,20 @@ var ConcertoHardware = {
|
|
12
12
|
$('#wknd_off_time_div').show();
|
13
13
|
}
|
14
14
|
},
|
15
|
+
updateAlwaysOn: function() {
|
16
|
+
show = !$('#player_always_on').is(':checked');
|
17
|
+
$('#on_off_details_div').toggle(show);
|
18
|
+
},
|
15
19
|
|
16
20
|
initPlayers: function() {
|
17
21
|
ConcertoHardware.updateWkndOnOff();
|
18
22
|
$('#player_wknd_disable').change(function() {
|
19
23
|
ConcertoHardware.updateWkndOnOff();
|
20
24
|
});
|
25
|
+
ConcertoHardware.updateAlwaysOn();
|
26
|
+
$('#player_always_on').change(function() {
|
27
|
+
ConcertoHardware.updateAlwaysOn();
|
28
|
+
});
|
21
29
|
}
|
22
30
|
};
|
23
31
|
|
@@ -88,7 +88,7 @@ class PlayersController < ConcertoHardware::ApplicationController
|
|
88
88
|
# Deal with strong parameter restrictions.
|
89
89
|
def player_params
|
90
90
|
params.require(:player).permit(:wkday_on_time, :wkday_off_time,
|
91
|
-
:wknd_on_time, :wknd_off_time, :wknd_disable, :force_off)
|
91
|
+
:wknd_on_time, :wknd_off_time, :wknd_disable, :force_off, :always_on)
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
@@ -9,6 +9,7 @@ module ConcertoHardware
|
|
9
9
|
# as parts of serialized JSON fields such as screen_on_off)
|
10
10
|
time_accessor :wkday_on_time, :wkday_off_time
|
11
11
|
time_accessor :wknd_on_time, :wknd_off_time
|
12
|
+
attr_accessor :always_on
|
12
13
|
attr_accessor :wknd_disable
|
13
14
|
attr_accessor :force_off
|
14
15
|
|
@@ -100,6 +101,12 @@ module ConcertoHardware
|
|
100
101
|
:date => Time.now.strftime("%Y-%m-%d")
|
101
102
|
}
|
102
103
|
end
|
104
|
+
if self.always_on == "1"
|
105
|
+
# Note: supersedes everything else.
|
106
|
+
ruleset << {
|
107
|
+
:action => "force_on"
|
108
|
+
}
|
109
|
+
end
|
103
110
|
if ruleset.empty? && self.screen_on_off.blank?
|
104
111
|
ruleset << {
|
105
112
|
:action => "on"
|
@@ -115,6 +122,7 @@ module ConcertoHardware
|
|
115
122
|
# supports 3 simple rules.
|
116
123
|
def retrieve_screen_on_off
|
117
124
|
return nil if screen_on_off.blank?
|
125
|
+
self.always_on = false # default unless rule exists
|
118
126
|
|
119
127
|
ruleset = ActiveSupport::JSON.decode(self.screen_on_off)
|
120
128
|
ruleset.each do |rule|
|
@@ -138,6 +146,9 @@ module ConcertoHardware
|
|
138
146
|
self.force_off = (rule['action'] != 'on')
|
139
147
|
end
|
140
148
|
end # force off rules
|
149
|
+
if rule['action'] == 'force_on'
|
150
|
+
self.always_on = true
|
151
|
+
end # always on
|
141
152
|
end # has an action
|
142
153
|
end # each rule
|
143
154
|
end # retrive_screen_on_off
|
@@ -156,6 +167,9 @@ module ConcertoHardware
|
|
156
167
|
rules = []
|
157
168
|
if self.screen_on_off.blank?
|
158
169
|
rules << "On/off times not configured. The screen will always be on."
|
170
|
+
elsif self.always_on
|
171
|
+
rules << "Screen is always on. Click 'Edit Player' to configure "+
|
172
|
+
"power-saving screen controls."
|
159
173
|
elsif !screen_on_off_valid
|
160
174
|
rules << "On/off rules are invalid. Edit and save the Player to fix."
|
161
175
|
else
|
@@ -21,7 +21,16 @@
|
|
21
21
|
</div>
|
22
22
|
</div>
|
23
23
|
|
24
|
+
<div class="clearfix">
|
25
|
+
<div class="input checkbox">
|
26
|
+
<ul class="inputs-list">
|
27
|
+
<li><%= f.check_box :always_on%> <%= f.label :always_on%> (<%= t('.always_on_msg') %>)</li>
|
28
|
+
</ul>
|
29
|
+
</div>
|
30
|
+
</div>
|
31
|
+
|
24
32
|
<!-- Screen on/off times. Good luck, UI designer. -->
|
33
|
+
<div id = "on_off_details_div">
|
25
34
|
<div class="clearfix">
|
26
35
|
<%= f.label :wkday_on_time %>
|
27
36
|
<div class="input-prepend">
|
@@ -66,6 +75,7 @@
|
|
66
75
|
</ul>
|
67
76
|
</div>
|
68
77
|
</div>
|
78
|
+
</div>
|
69
79
|
</fieldset>
|
70
80
|
|
71
81
|
<div class="submit_bar actions">
|
data/config/locales/en.yml
CHANGED
@@ -12,6 +12,7 @@ en:
|
|
12
12
|
wknd_on_time: 'Weekend turn on time'
|
13
13
|
wknd_off_time: 'Weekend turn off time'
|
14
14
|
screen_on_off_times: "Screen On/Off Times"
|
15
|
+
always_on: "Player Always On"
|
15
16
|
errors:
|
16
17
|
models:
|
17
18
|
concerto_hardware/player:
|
@@ -27,6 +28,7 @@ en:
|
|
27
28
|
form:
|
28
29
|
provide_details: "Provide Details"
|
29
30
|
force_off_msg: "temporarily turns off the screen until midnight tonight"
|
31
|
+
always_on_msg: "prevents Concerto from turning off the screen, but may waste energy"
|
30
32
|
show_body:
|
31
33
|
no_screen_found: "No Screen Found"
|
32
34
|
is_activated: "Activated"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: concerto_hardware
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Concerto Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|