ish_manager 0.1.8.402 → 0.1.8.403

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: 99464fcd8fa7b0f58cb5d7eb6b62dec9e62fb6b5d8da4500bb7b11362a5042a0
4
- data.tar.gz: 71fdb74c90c9d4d7ead1b5d410e2516f29dc51e2bc1a67aaf0d712189527a3e8
3
+ metadata.gz: 8a3b2381f54eb7b66d392fbaa4051bd78ee53f1ad8b455f8a55db82a0c9fca62
4
+ data.tar.gz: 65a33aebdf8b15526dee6e37f62824b304f2a0672eef3e55ebd866dd072d5fe8
5
5
  SHA512:
6
- metadata.gz: 4123acb840e9676a335b2d8664182e6b81ab7f353ddd0627eea8ee637402269120c419bae5142ca62f5d2709da8f540bb083c5ac5cb5c2bc5bf76d7526fb19e9
7
- data.tar.gz: 155d66ae258ed66afb40f01fa9083d422875e0a40e0f3b1249b34f23610626305bdf04c7b66071397197591c2dcb89acbdde98d634cc3d10b5573d3a008a5639
6
+ metadata.gz: a7284a7a74330a4878a4b2136e17aa3c8ac47079fcbb36fb758c7c8b8252bbcc84eb66c578789971af86bad0fa2b39568285d72024be5185fb7f632c01d5beaa
7
+ data.tar.gz: 047b94313ffef19b69373fdc99d918d9c4f9c4ab76e87d75256e086a8d0e9b12a0c891eb02bc259c32a8edb5bbc6b870733fc485b8cee2765300c58b147c9075
@@ -0,0 +1,45 @@
1
+
2
+ class ::IshManager::IroPositionsController < IshManager::ApplicationController
3
+
4
+ before_action :set_lists
5
+
6
+ def create
7
+ @position = Iro::Position.new({
8
+ iro_purse: @purse = Iro::Purse.find_or_create_by({ user_id: current_user.id }),
9
+ type: 'Iro::CoveredCall',
10
+ })
11
+ authorize! :update, @position
12
+
13
+ if @position.update params[:position].permit!
14
+ flash[:notice] = 'Successfully updated position.'
15
+ redirect_to controller: 'iro_purses', action: :show
16
+ else
17
+ flash[:alert] = "Cannot update position: #{@position.errors.full_messages.join(', ')}."
18
+ render action: 'edit'
19
+ end
20
+ end
21
+
22
+ def edit
23
+ @position = Iro::Position.find params[:id]
24
+ authorize! :edit, @position
25
+ end
26
+
27
+ def new
28
+ @position = Iro::Position.new
29
+ authorize! :new, @position
30
+ end
31
+
32
+ def update
33
+ @position = Iro::Position.find params[:id]
34
+ authorize! :update, @position
35
+
36
+ if @position.update params[:position].permit!
37
+ flash[:notice] = 'Successfully updated position.'
38
+ redirect_to controller: 'iro_purses', action: :show
39
+ else
40
+ flash[:alert] = "Cannot update position: #{@position.errors.full_messages.join(', ')}."
41
+ render action: 'edit'
42
+ end
43
+ end
44
+
45
+ end
@@ -3,10 +3,11 @@ class ::IshManager::IroPursesController < IshManager::ApplicationController
3
3
 
4
4
  before_action :set_lists
5
5
 
6
- def my
6
+ def show
7
7
  @purse = Iro::Purse.find_or_create_by({ user_id: current_user.id })
8
8
  authorize! :my, @purse
9
9
  @positions = @purse.positions.order({ expires_on: :asc, strike: :asc })
10
+ @positions.map &:refresh
10
11
  @strategies = Iro::CoveredCallStrategy.where({
11
12
  iro_purse_id: Iro::Purse.find_by( user_id: current_user.id ).id,
12
13
  })
@@ -0,0 +1,34 @@
1
+
2
+ - url = position.new_record? ? iro_positions_path : iro_position_path( position )
3
+
4
+ .iro-positions--form
5
+ = form_for position, as: :position, url: url do |f|
6
+ .flex-row
7
+ .field Position ##{position.id}
8
+ .field
9
+ = f.label :strategy
10
+ = f.select :iro_strategy_id, options_for_select( Iro::CoveredCallStrategy.list, selected: position.iro_strategy_id ), {}, class: 'select2'
11
+ .field
12
+ = f.label :ticker
13
+ = f.text_field :ticker
14
+
15
+ .field
16
+ = f.label :strike
17
+ = f.number_field :strike, step: 0.01
18
+
19
+ .field
20
+ = f.label :expires_on
21
+ = f.text_field :expires_on
22
+ .field
23
+ = f.label :status
24
+ = f.select :status, options_for_select( Iro::Position.statuses_list, selected: position.status ), {}, class: 'select2'
25
+
26
+ .field
27
+ = f.label :opened_price
28
+ = f.text_field :opened_price
29
+ .field
30
+ = f.label :opened_on
31
+ = f.text_field :opened_on
32
+
33
+ .actions
34
+ = f.submit 'Submit'
@@ -0,0 +1,3 @@
1
+
2
+ .iro-positions-edit.padded
3
+ = render 'form', position: @position
@@ -0,0 +1,3 @@
1
+
2
+ .iro-positions-new.padded
3
+ = render 'form', position: @position
@@ -1,9 +1,10 @@
1
1
 
2
2
  .iro-purses-my.padded
3
3
  .header
4
- %h2.title My purse value: $#{@purse.current_value}
4
+ %h2.title Purse value: $#{@purse.current_value}
5
5
 
6
6
  .strategies
7
+ .title Strategies
7
8
  - @strategies.each do |strat|
8
9
  .strategy
9
10
  = link_to '[~]', edit_iro_strategy_path( strat )
@@ -11,13 +12,15 @@
11
12
 
12
13
 
13
14
  .positions
14
- %h3 Positions (#{@positions.length})
15
+ %h3
16
+ Positions (#{@positions.length})
17
+ = link_to '[+]', new_iro_position_path
15
18
 
16
19
  %table.bordered
17
20
  %thead
18
21
  %tr
19
22
  %td id
20
- %td Strat
23
+ %td Strategy
21
24
  %td Ticker
22
25
  %td Kind/Type
23
26
  %td Strike
@@ -40,8 +43,10 @@
40
43
  %tbody
41
44
  - @positions.each do |p|
42
45
  %tr
43
- %td= p.id
44
- %td= p.iro_strategy_id
46
+ %td
47
+ = p.id
48
+ = link_to '[~]', edit_iro_position_path(p)
49
+ %td= p.strategy
45
50
  %td= p.ticker
46
51
  %td= p.type == "Iro::CoveredCall" ? "CALL" : "other"
47
52
  %td= p.strike
data/config/routes.rb CHANGED
@@ -25,10 +25,11 @@ IshManager::Engine.routes.draw do
25
25
  # end
26
26
  # resources :orders
27
27
 
28
+ resources :iro_positions
28
29
 
29
30
  # get 'iro_watches', to: 'iro_watches#index'
30
31
  resources :iro_watches
31
- get 'iro_purse', to: 'iro_purses#my', as: :my_purse
32
+ get 'iro_purse', to: 'iro_purses#show', as: :my_purse
32
33
 
33
34
  resources :iro_strategies
34
35
 
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.402
4
+ version: 0.1.8.403
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
@@ -320,6 +320,7 @@ files:
320
320
  - app/controllers/ish_manager/galleries_controller.rb
321
321
  - app/controllers/ish_manager/image_assets_controller.rb
322
322
  - app/controllers/ish_manager/invoices_controller.rb
323
+ - app/controllers/ish_manager/iro_positions_controller.rb
323
324
  - app/controllers/ish_manager/iro_purses_controller.rb
324
325
  - app/controllers/ish_manager/iro_strategies_controller.rb
325
326
  - app/controllers/ish_manager/iro_watches_controller.rb
@@ -478,7 +479,10 @@ files:
478
479
  - app/views/ish_manager/iro_mailer/condor_followup_alerb.html.erb
479
480
  - app/views/ish_manager/iro_mailer/option_alert.html.erb
480
481
  - app/views/ish_manager/iro_mailer/stock_alert.html.erb
481
- - app/views/ish_manager/iro_purses/my.haml
482
+ - app/views/ish_manager/iro_positions/_form.haml
483
+ - app/views/ish_manager/iro_positions/edit.haml
484
+ - app/views/ish_manager/iro_positions/new.haml
485
+ - app/views/ish_manager/iro_purses/show.haml
482
486
  - app/views/ish_manager/iro_strategies/_form.haml
483
487
  - app/views/ish_manager/iro_strategies/edit.haml
484
488
  - app/views/ish_manager/iro_strategies/new.haml