ish_manager 0.1.8.399 → 0.1.8.400

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
  SHA256:
3
- metadata.gz: ab3eb4ae2c3ce1d114b30a3327dcb37631d38599df86c5e12dbe4cc1ce0fd44a
4
- data.tar.gz: 109c4fe36fc77458ea0fbfdd6615e1264a2985116f16b5466ef1d3594fde8b9c
3
+ metadata.gz: 4e852f56630ecb6853fb58a102f50824fb8237f359d99033b35fb5735a1edf62
4
+ data.tar.gz: fffe66f056d0fde15b5553e1390902dffd49c3b4d093e56cd7886bccb5b95c43
5
5
  SHA512:
6
- metadata.gz: 0e262ac280849d4fab6fcb951224a813d9664e097b2a28b11399d380d145f6f8d4623b086702b3898c60d553270e230f09874093f56647ac994a2cb5e0056338
7
- data.tar.gz: 1a684d88b90fc52f9ceac39bf4380eb57153f48c653c0e4eefa711e9e47306eed8b5ae5af4c5d007bfdab2b7074fd0f7a63ce8a08baf0073e48b97b41bed977a
6
+ metadata.gz: 5ce863f62c564c5245844ac2d3e7564a0766696ec4cf5ad3fbed01ae1423f7ceff4ca4f258fa91b976cbcb3c04662effa81b30aefab16703477dce61a9efa8b8
7
+ data.tar.gz: 800017a26feb619e985c6487d3c7fb3b563cb2154596bad08b9c88c0e7f92509e3b2fd10e30b344c0192f5fe8da2508e3488947ac947c15de264fdf68390774e
@@ -1,50 +1,47 @@
1
1
 
2
2
  class ::IshManager::IroWatchesController < IshManager::ApplicationController
3
3
 
4
- before_action :set_lists
5
-
6
- def index
7
- # authorize! :index, Ish::Invoice
8
- # @invoices = Ish::Invoice.all.includes( :payments )
9
- raise 'not implemented'
4
+ # before_action :set_lists
5
+
6
+ def create
7
+ @option_watch = Iro::OptionWatch.new params[:iro_watch].permit!
8
+ authorize! :create, @option_watch
9
+ flag = @option_watch.save
10
+ if flag
11
+ flash[:notice] = 'Created option watch.'
12
+ else
13
+ flash[:alert] = "Cannot create option watch: #{@option_watch.errors.full_messages.join(', ')}."
14
+ end
15
+ redirect_to action: 'index'
10
16
  end
11
17
 
12
- # def new
13
- # authorize! :new, @invoice
14
- # end
15
-
16
- # def create
17
- # @invoice = Ish::Invoice.new params[:invoice].permit!
18
- # authorize! :create, @invoice
19
- # if @invoice.save
20
- # flash[:notice] = "created invoice"
21
- # else
22
- # flash[:alert] = "Cannot create invoice: #{@invoice.errors.messages}"
23
- # end
24
- # redirect_to :action => 'index'
25
- # end
26
-
27
- # def update
28
- # @invoice = Ish::Invoice.find params[:id]
29
- # authorize! :update, @invoice
30
- # if @invoice.update_attributes params[:invoice].permit!
31
- # flash[:notice] = 'Success'
32
- # redirect_to :action => 'index'
33
- # else
34
- # flash[:alert] = "Cannot update invoice: #{@invoice.errors.messages}"
35
- # end
36
- # redirect_to :action => 'index'
37
- # end
18
+ def destroy
19
+ @w = Iro::OptionWatch.find params[:id]
20
+ authorize! :destroy, @w
21
+ flag = @w.destroy
22
+ if flag
23
+ flash[:notice] = 'Success.'
24
+ else
25
+ flash[:alert] = @w.errors.full_messages.join(", ")
26
+ end
27
+ redirect_to action: 'index'
28
+ end
38
29
 
39
- #
40
- # private
41
- #
42
- private
30
+ def index
31
+ authorize! :index, Iro::OptionWatch
32
+ @watches = Iro::OptionWatch.order_by( ticker: :asc, direction: :asc, price: :desc)
33
+ end
43
34
 
44
- def set_lists
45
- # @invoice_number = Ish::Invoice.order_by( :number => :desc ).first
46
- # @invoice_number = @invoice_number ? @invoice_number.number + 1 : 1
47
- # @new_invoice = Ish::Invoice.new :number => @invoice_number
35
+ def update
36
+ @option_watch = Iro::OptionWatch.find params[:id]
37
+ authorize! :update, @option_watch
38
+ flag = @option_watch.update_attributes params[:iro_watch].permit!
39
+ if flag
40
+ flash[:notice] = 'Updated option watch.'
41
+ else
42
+ flash[:alert] = "Cannot update option watch: #{@option_watch.errors.full_messages.join(', ')}."
43
+ end
44
+ redirect_to action: 'index'
48
45
  end
49
46
 
50
47
  end
@@ -20,9 +20,12 @@ module IshManager
20
20
  mail( :to => option.profile.email, :subject => "IshManager Option Alert :: #{option.ticker}" ).deliver
21
21
  end
22
22
 
23
- def stock_alert stock
24
- @stock = stock
25
- mail( :to => stock.profile.email, :subject => "IshManager Stock Alert :: #{stock.ticker}" ).deliver
23
+ def stock_alert watch_id
24
+ @watch = Iro::OptionWatch.find watch_id
25
+ mail({
26
+ to: @watch.profile.email,
27
+ subject: "Iro Watch Alert :: #{@watch.ticker} is #{@watch.direction} #{@watch.mark}."
28
+ })
26
29
  end
27
30
 
28
31
  def test_email
@@ -0,0 +1,4 @@
1
+
2
+ %p Stock alert:
3
+
4
+ %p= @watch.inspect
@@ -0,0 +1,26 @@
1
+
2
+ - url = watch.new_record? ? iro_watches_path : iro_watch_path(watch)
3
+ .iro-watches--form
4
+ = form_for watch, url: url, as: :iro_watch do |f|
5
+ .flex-row
6
+ .form-group
7
+ = f.select :state, options_for_select( Iro::OptionWatch.states_list, selected: watch.state )
8
+ .form-group
9
+ = f.select :kind, options_for_select( Iro::OptionWatch.kinds_list, selected: watch.kind )
10
+ .form-group
11
+ -# = f.label :action
12
+ = f.select :action, options_for_select( Iro::OptionWatch.actions_list, :selected => watch.action )
13
+ .form-group
14
+ -# = f.label :profile
15
+ = f.select :profile, options_for_select( Ish::UserProfile.list, selected: watch.profile_id ), {}, class: 'select2'
16
+ .form-group
17
+ %label.control-label When
18
+ = f.text_field :ticker, :placeholder => 'ticker'
19
+ .form-group
20
+ %label.control-label is
21
+ = f.select :direction, options_for_select( Iro::OptionWatch.directions_list, selected: watch.direction )
22
+ .form-group
23
+ %label.control-label $
24
+ = f.number_field :mark, :step => 0.01, :placeholder => "0.01"
25
+ .form-group
26
+ = f.submit ">", :class => %w(btn blue)
@@ -0,0 +1,13 @@
1
+
2
+ .iro-watches-index.padded
3
+ .header
4
+ .title Iro Watches
5
+
6
+
7
+ - @watches.each do |watch|
8
+ = render 'form', :watch => watch
9
+
10
+ %hr
11
+ %h5 New
12
+ = render 'form', :watch => Iro::OptionWatch.new
13
+
data/config/routes.rb CHANGED
@@ -26,7 +26,8 @@ IshManager::Engine.routes.draw do
26
26
  # resources :orders
27
27
 
28
28
 
29
- get 'iro_watches', to: 'iro_watches#index'
29
+ # get 'iro_watches', to: 'iro_watches#index'
30
+ resources :iro_watches
30
31
  get 'iro_purse', to: 'iro_purses#my', as: :my_purse
31
32
 
32
33
  resources :iro_strategies
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ish_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8.399
4
+ version: 0.1.8.400
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-30 00:00:00.000000000 Z
11
+ date: 2023-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -394,6 +394,7 @@ files:
394
394
  - app/views/ish_manager/application/_search.haml
395
395
  - app/views/ish_manager/application/home.haml
396
396
  - app/views/ish_manager/application_mailer/shared_galleries.html.erb
397
+ - app/views/ish_manager/application_mailer/stock_alert.haml
397
398
  - app/views/ish_manager/application_mailer/test_email.html.erb
398
399
  - app/views/ish_manager/application_mailer/welcome.html.erb
399
400
  - app/views/ish_manager/categories/_subtree.haml
@@ -481,6 +482,8 @@ files:
481
482
  - app/views/ish_manager/iro_strategies/_form.haml
482
483
  - app/views/ish_manager/iro_strategies/edit.haml
483
484
  - app/views/ish_manager/iro_strategies/new.haml
485
+ - app/views/ish_manager/iro_watches/_form.haml
486
+ - app/views/ish_manager/iro_watches/index.haml
484
487
  - app/views/ish_manager/kaminari/_first_page.html.erb
485
488
  - app/views/ish_manager/kaminari/_gap.html.erb
486
489
  - app/views/ish_manager/kaminari/_last_page.html.erb