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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7755452c779d4727103fc30b2a4240fab346bcf0
4
- data.tar.gz: b4ac85892d72694abe88eb8203230083e479a631
3
+ metadata.gz: 60218790f815f50493889a41f7159684350b2832
4
+ data.tar.gz: 59f19eff655c4ab07161be98783b3aec94ce2fb0
5
5
  SHA512:
6
- metadata.gz: 527f89252a3e7aaf88468aa0e606d2cacc40c0690300625277d38b675630f12776d3bdf83941d9df5689976643477e2114d0f2738830a96a717c6b9e2d0bf80f
7
- data.tar.gz: c91e1657fb61bcafd689e9eeee934454dce3b028b557672b1517b871711c2208085e187358ece759c0a543bc3d7dff55ac670169dcf007e7fdc3c0201691eb3c
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">
@@ -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"
@@ -1,3 +1,3 @@
1
1
  module ConcertoHardware
2
- VERSION = "0.3"
2
+ VERSION = "0.4"
3
3
  end
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.3'
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-04-08 00:00:00.000000000 Z
11
+ date: 2015-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails