ish_manager 0.1.8.56 → 0.1.8.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3b27e886a39fd33949a37884935736026aa084e2
4
- data.tar.gz: 81d785e017bf73d55acf902311f6a5acc9fd19cd
3
+ metadata.gz: 42bbdd4482e26273e7f503f3d6968a7542a6390b
4
+ data.tar.gz: 5d38163d5a4841676f0f6a55b19c7686bd9af538
5
5
  SHA512:
6
- metadata.gz: d482ec1d7f8186bddd27cc7b342cc894f562e8cd02c7ed391712af654acf25d379c77e245c5c2b43cef1d98882039700093c72a74264d1bb6f11434c76dc6c7d
7
- data.tar.gz: cdb7d8495f8098c4734156532d3b2aa1e9a18606950d297783fd60569f6e7cbe91aef15c6060bad49d7acfd02cded1f9800cf14d6250e66b6c403c8308a0bb7f
6
+ metadata.gz: 3f2bcad9b8957180a5280ee9ccddb967982bdca02b6bc3a9b225e0694f23d0db64ec23c0ef3930ad6919006351d2626ae60c3499108a2dc3d36d2155acb48b60
7
+ data.tar.gz: 277e38495bcefbd68c352aa4ed225f99958887bc6cfe40e3043fda4e23f2ae049f5aae58927238a25cbcf96fe53d527ca3e1fa427716ce30d03969405421b4c1
@@ -117,7 +117,7 @@ ul.tags ul.tags {
117
117
  }
118
118
 
119
119
  /**
120
- * ally
120
+ * ally, stock watches
121
121
  */
122
122
  .price {
123
123
  /* margin-left: 1em; */
@@ -131,3 +131,10 @@ ul.tags ul.tags {
131
131
  top: 1em;
132
132
  left: 0;
133
133
  }
134
+ table.stock_watches td {
135
+ border-right: 1px solid cyan;
136
+ padding: 15px;
137
+ }
138
+ table.stock_watches .trashy {
139
+ background: #cecece;
140
+ }
@@ -0,0 +1,39 @@
1
+
2
+ class IshManager::StockWatchesController < IshManager::ApplicationController
3
+
4
+ def index
5
+ authorize! :index, IshModels::StockWatch
6
+ @profiles = IshModels::UserProfile.all
7
+ @stock_watches = IshModels::StockWatch.all.includes( :profile )
8
+ @stock_watch = IshModels::StockWatch.new
9
+ render 'index', :layout => 'ish_manager/application_no_materialize'
10
+ end
11
+
12
+ def create
13
+ @stock_watch = IshModels::StockWatch.new params[:ish_models_stock_watch].permit!
14
+ authorize! :create, @stock_watch
15
+ flag = @stock_watch.save
16
+ if flag
17
+ flash[:notice] = 'Created stock watch.'
18
+ else
19
+ flash[:alert] = "Cannot create stock watch: #{@stock_watch.errors.messages}"
20
+ end
21
+ redirect_to :action => 'index'
22
+ end
23
+
24
+ def update
25
+ @stock_watch = IshModels::StockWatch.find params[:id]
26
+ authorize! :update, @stock_watch
27
+ flag = @stock_watch.update_attributes params[:ish_models_stock_watch].permit!
28
+ if flag
29
+ flash[:notice] = 'Updated stock watch.'
30
+ else
31
+ flash[:alert] = "Cannot update stock watch: #{@stock_watch.errors.messages}"
32
+ end
33
+ redirect_to :action => 'index'
34
+ end
35
+
36
+ end
37
+
38
+
39
+
@@ -2,7 +2,7 @@
2
2
  class IshManager::UserProfilesController < IshManager::ApplicationController
3
3
 
4
4
  def index
5
- @user_profiles = IshModels::UserProfile.all
5
+ @user_profiles = IshModels::UserProfile.all.includes( :user )
6
6
  authorize! :index, IshModels::UserProfile
7
7
  end
8
8
 
@@ -1,3 +1,4 @@
1
+
1
2
  module IshManager
2
3
  class ApplicationMailer < ActionMailer::Base
3
4
  default from: 'from@example.com'
@@ -10,7 +11,7 @@ module IshManager
10
11
 
11
12
  def stock_alert stock
12
13
  @stock = stock
13
- mail( :to => 'piousbox@gmail.com', :subject => 'IshManager Stock Alert' ).deliver
14
+ mail( :to => stock.profile.email, :subject => 'IshManager Stock Alert' ).deliver
14
15
  end
15
16
 
16
17
  end
@@ -10,7 +10,7 @@ class IshManager::Ability
10
10
  unless user.blank?
11
11
 
12
12
  # role manager
13
- if user.profile && user.profile.role_name == :manager
13
+ if user.profile && [ :manager, :admin ].include?( user.profile.role_name )
14
14
 
15
15
  can [ :create_newsitem, :show, :new_feature, :create_feature ], ::City
16
16
 
@@ -25,6 +25,7 @@ class IshManager::Ability
25
25
  can [ :show, :edit, :update, :create_newsitem, :new_feature, :create_feature ], ::Site do |site|
26
26
  !site.is_private && !site.is_trash
27
27
  end
28
+ can [ :manage ], IshModels::StockWatch
28
29
 
29
30
  # can [ :new_feature, :create_feature ], ::Tag
30
31
 
@@ -14,6 +14,6 @@
14
14
  %li{ :class => params[:controller] == 'ish_manager/tags' ? 'active' : '' }= link_to 'Tags', tags_path
15
15
  %li{ :class => params[:controller] == 'ish_manager/venues' ? 'active' : '' }= link_to 'Venues', venues_path
16
16
  %li{ :class => params[:controller] == 'ish_manager/videos' ? 'active' : '' }= link_to 'Videos', videos_path
17
- %li{ :class => params[:controller] == 'ish_manager/ally' ? 'active' : '' }= link_to 'Ally', ally_root_path
17
+ %li{ :class => params[:controller] == 'ish_manager/stock_watches' ? 'active' : '' }= link_to 'Ally', stock_watches_path
18
18
  %hr
19
19
 
@@ -0,0 +1,20 @@
1
+
2
+ - url = stock_watches_path if !stock_watch.persisted?
3
+ - url = stock_watch_path( stock_watch ) if stock_watch.persisted?
4
+
5
+ = form_for stock_watch, :url => url, :html => { :class => 'form-inline well' } do |f|
6
+ .form-group
7
+ = f.select :action, options_for_select( IshModels::StockWatch::ACTIONS.map{|a|[a,a]}, :selected => stock_watch.action )
8
+ .form-group
9
+ = f.select :profile, options_for_select( [[nil,nil]]+@profiles.map{|p|[p.email,p.id]}, :selected => stock_watch.profile ? stock_watch.profile.id : nil )
10
+ .form-group
11
+ %label.control-label When
12
+ = f.text_field :ticker, :class => 'form-control', :placeholder => 'ticker'
13
+ .form-group
14
+ %label.control-label Price
15
+ = f.select :direction, options_for_select( IshModels::StockWatch::DIRECTIONS.map{|d|[d,d]}, :selected => stock_watch.direction )
16
+ .form-group
17
+ %label.control-label $
18
+ = f.number_field :price, :step => 0.01, :placeholder => "0.01"
19
+ .form-group
20
+ = f.submit ">", :class => %w(btn blue)
@@ -0,0 +1,10 @@
1
+
2
+ %h4 Ally / Home
3
+
4
+ %hr
5
+ - @stock_watches.each do |stock|
6
+ = render 'form', :stock_watch => stock
7
+
8
+ %hr
9
+ %h5 New
10
+ = render 'form', :stock_watch => @stock_watch
@@ -1,12 +1,19 @@
1
1
 
2
+ %h5 Editing profile of user #{@profile.user.email}
2
3
  .a
3
4
  = form_for @profile do |f|
4
5
  .field
5
6
  = f.label :email
6
- = f.text_field :email, :disabled => true
7
+ = f.text_field :email
7
8
  .field
8
9
  = f.label :role_name
9
10
  = f.select :role_name, ::IshModels::UserProfile::ROLES
11
+ .field
12
+ = f.label :fb_access_token
13
+ = f.text_field :fb_access_token
14
+ .field
15
+ = f.label :fb_long_access_token
16
+ = f.text_field :fb_long_access_token
10
17
  .action
11
18
  = f.submit 'Submit', :class => %w(button)
12
19
 
@@ -8,7 +8,8 @@
8
8
  .panel
9
9
  %ul
10
10
  %li= link_to '[edit]', edit_user_profile_path( profile )
11
- %li Email: #{profile.email}
12
- %li Name: #{profile.name}
13
- %li Role: #{profile.role_name}
11
+ %li <b>Email:</b> #{profile.email}
12
+ %li <b>Name:</b> #{profile.name}
13
+ %li <b>Role:</b> #{profile.role_name}
14
+ %li <b>User.email:</b> #{profile.user.email}
14
15
  %br
data/config/routes.rb CHANGED
@@ -1,10 +1,6 @@
1
1
  IshManager::Engine.routes.draw do
2
2
  root :to => 'application#home'
3
3
 
4
- scope :ally, :as => 'ally' do
5
- root :to => 'ally#home'
6
- end
7
-
8
4
  resources :cities do
9
5
  resources :features
10
6
  resources :newsitems
@@ -36,6 +32,11 @@ IshManager::Engine.routes.draw do
36
32
  resources :newsitems
37
33
  resources :reports
38
34
  end
35
+
36
+ resources :stock_watches
37
+ # scope :ally, :as => 'ally' do
38
+ # root :to => 'ally#home'
39
+ # end
39
40
 
40
41
  resources :tags
41
42
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ish_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8.56
4
+ version: 0.1.8.57
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
@@ -138,7 +138,6 @@ files:
138
138
  - app/assets/stylesheets/ish_manager/materialize.css
139
139
  - app/assets/stylesheets/ish_manager/trash/bootstrap.min.css
140
140
  - app/assets/stylesheets/ish_manager/trash/bootstrap.min.css.map
141
- - app/controllers/ish_manager/ally_controller.rb
142
141
  - app/controllers/ish_manager/application_controller.rb
143
142
  - app/controllers/ish_manager/cities_controller.rb
144
143
  - app/controllers/ish_manager/features_controller.rb
@@ -148,6 +147,7 @@ files:
148
147
  - app/controllers/ish_manager/photos_controller.rb
149
148
  - app/controllers/ish_manager/reports_controller.rb
150
149
  - app/controllers/ish_manager/sites_controller.rb
150
+ - app/controllers/ish_manager/stock_watches_controller.rb
151
151
  - app/controllers/ish_manager/tags_controller.rb
152
152
  - app/controllers/ish_manager/user_profiles_controller.rb
153
153
  - app/controllers/ish_manager/user_profiles_controller.rb~
@@ -162,7 +162,6 @@ files:
162
162
  - app/models/ish_manager/ability.rb
163
163
  - app/models/ish_manager/ability.rb~
164
164
  - app/models/ish_manager/application_record.rb
165
- - app/views/ish_manager/ally/home.haml
166
165
  - app/views/ish_manager/application/_form_errors.haml
167
166
  - app/views/ish_manager/application/_main_footer.haml
168
167
  - app/views/ish_manager/application/_main_header.haml
@@ -257,6 +256,8 @@ files:
257
256
  - app/views/ish_manager/sites/index.haml
258
257
  - app/views/ish_manager/sites/new.haml
259
258
  - app/views/ish_manager/sites/show.haml
259
+ - app/views/ish_manager/stock_watches/_form.haml
260
+ - app/views/ish_manager/stock_watches/index.haml
260
261
  - app/views/ish_manager/tags/_features.haml
261
262
  - app/views/ish_manager/tags/_form.haml
262
263
  - app/views/ish_manager/tags/_index.haml
@@ -1,12 +0,0 @@
1
-
2
- class IshManager::AllyController < IshManager::ApplicationController
3
-
4
- def home
5
- authorize! :home_ally, IshManager::Ability
6
- render 'home', :layout => 'ish_manager/application_no_materialize'
7
- end
8
-
9
- end
10
-
11
-
12
-
@@ -1,19 +0,0 @@
1
-
2
- %h1 Ally / Home
3
-
4
- = form_tag nil, :class => 'form-inline well' do
5
- .form-group
6
- %select
7
- %option{ :value => "Email Me" } Email Me
8
- %option{ :value => "Do Nothing" } Do Nothing
9
- .form-group
10
- %label.control-label When
11
- = text_field_tag :ticker, 'NFLX', :class => 'form-control'
12
- .form-group
13
- %label.control-label Price
14
- = select_tag :direction, options_for_select([ ['rises above', nil], ['falls below', nil] ])
15
- .form-group
16
- %label.control-label $
17
- = number_field_tag :price, 99.99
18
- .form-group
19
- = button_tag ">", :class => %w(btn blue)