ish_manager 0.1.8.397 → 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: 48dd240bd2406498ff4432cced69350c3c66efb13c339ed5dfaefb421d256e5b
4
- data.tar.gz: 97c1195165ccac014df21e423315cebacf3bcdc51aac7c40095f7d8a3bd4ac2f
3
+ metadata.gz: 4e852f56630ecb6853fb58a102f50824fb8237f359d99033b35fb5735a1edf62
4
+ data.tar.gz: fffe66f056d0fde15b5553e1390902dffd49c3b4d093e56cd7886bccb5b95c43
5
5
  SHA512:
6
- metadata.gz: dc4895c6a5da8056ef2557cb3609fd512a71f3c14bd4181120337323b6ec6161863e385e8aa119ae7827260406ae07e2888e0bbb2c21fe28873f2838dc58c251
7
- data.tar.gz: dcee31234fecc15bfd8db0f09d6169c99116ddbd63edd81a871a7e55d5b23e9243add1870d8951d62620398317a82562a46be04830f95032a0dac76a4aebe0c5
6
+ metadata.gz: 5ce863f62c564c5245844ac2d3e7564a0766696ec4cf5ad3fbed01ae1423f7ceff4ca4f258fa91b976cbcb3c04662effa81b30aefab16703477dce61a9efa8b8
7
+ data.tar.gz: 800017a26feb619e985c6487d3c7fb3b563cb2154596bad08b9c88c0e7f92509e3b2fd10e30b344c0192f5fe8da2508e3488947ac947c15de264fdf68390774e
@@ -94,6 +94,7 @@
94
94
 
95
95
  .my-actions {
96
96
  display: flex;
97
+ flex-direction: column;
97
98
  }
98
99
 
99
100
  .preview {
@@ -1,99 +1,101 @@
1
1
 
2
2
  require 'business_time'
3
3
 
4
- module IshManager
5
- class ApplicationController < ActionController::Base
6
-
7
- protect_from_forgery :with => :exception, :prepend => true
8
- before_action :set_current_ability
9
- before_action :set_changelog
10
- before_action :set_title
11
- before_action :set_jwt
12
- check_authorization
13
- rescue_from ::CanCan::AccessDenied, :with => :access_denied
14
-
15
- before_action :basic_auth
16
- def basic_auth
17
- return if Rails.env.test?
18
- http_basic_authenticate_or_request_with :name => BASIC_AUTH_NAME, :password => BASIC_AUTH_PASSWORD
19
- end
20
4
 
21
- def home
22
- authorize! :home, IshManager::Ability
23
- render 'home'
24
- end
5
+ class IshManager::ApplicationController < ActionController::Base
25
6
 
26
- #
27
- # private
28
- #
29
- private
7
+ protect_from_forgery :with => :exception, :prepend => true
8
+ before_action :set_current_ability
9
+ before_action :set_changelog
10
+ before_action :set_title
11
+ before_action :set_jwt
12
+ check_authorization
13
+ rescue_from ::CanCan::AccessDenied, :with => :access_denied
30
14
 
31
- def access_denied exception
32
- store_location_for :user, request.path
33
- redirect_to user_signed_in? ? root_path : Rails.application.routes.url_helpers.new_user_session_path, :alert => exception.message
34
- end
15
+ before_action :basic_auth
16
+ def basic_auth
17
+ return if Rails.env.test?
18
+ http_basic_authenticate_or_request_with :name => BASIC_AUTH_NAME, :password => BASIC_AUTH_PASSWORD
19
+ end
35
20
 
36
- def encode(payload, exp = 48.hours.from_now) # @TODO: definitely change, right now I expire once in 2 days.
37
- payload[:exp] = exp.to_i
38
- JWT.encode(payload, Rails.application.secrets.secret_key_base.to_s)
39
- end
21
+ def home
22
+ authorize! :home, IshManager::Ability
23
+ render 'home'
24
+ end
40
25
 
41
- def pp_errors err
42
- err
43
- end
26
+ #
27
+ # private
28
+ #
29
+ private
44
30
 
45
- def puts! a, b=''
46
- puts "+++ +++ #{b}"
47
- puts a.inspect
48
- end
31
+ def access_denied exception
32
+ store_location_for :user, request.path
33
+ redirect_to user_signed_in? ? root_path : Rails.application.routes.url_helpers.new_user_session_path, :alert => exception.message
34
+ end
49
35
 
50
- def set_changelog
51
- @version = Gem.loaded_specs['ish_manager'].version.to_s
52
- end
36
+ def encode(payload, exp = 48.hours.from_now) # @TODO: definitely change, right now I expire once in 2 days.
37
+ payload[:exp] = exp.to_i
38
+ JWT.encode(payload, Rails.application.secrets.secret_key_base.to_s)
39
+ end
53
40
 
54
- def set_current_ability
55
- if !current_user
56
- raise ::CanCan::AccessDenied
57
- end
58
- @current_profile ||= ::Ish::UserProfile.find_by({ email: current_user.email })
59
- @current_ability ||= ::IshManager::Ability.new( @current_profile )
60
- end
41
+ def pp_errors err
42
+ err
43
+ end
61
44
 
62
- def set_jwt
63
- @jwt_token = encode(user_profile_id: @current_user.profile.id.to_s)
64
- end
45
+ def puts! a, b=''
46
+ puts "+++ +++ #{b}"
47
+ puts a.inspect
48
+ end
65
49
 
66
- def set_lists
67
- @galleries_list = Gallery.all.list
68
- @locations_list = ::Gameui::Map.list
69
- @maps_list = ::Gameui::Map.list # @TODO: missing nonpublic!
70
- @reports_list = Report.all.list
71
- @user_profiles_list = Ish::UserProfile.list
72
- @videos_list = Video.all.list
73
- @leads_list = Lead.list
74
- @leadsets_list = Leadset.list
75
- @email_actions_list = [[nil,nil]] + Office::EmailAction.all.map { |a| [ a.slug, a.id ] }
76
- @email_templates_list = [[nil,nil]] + Ish::EmailTemplate.all.map { |t| [ t.slug, t.id ] }
77
- end
50
+ def set_changelog
51
+ @version = Gem.loaded_specs['ish_manager'].version.to_s
52
+ end
78
53
 
79
- def set_title
80
- @page_title = "#{ params[:controller].gsub('ish_manager/', '') } #{params[:action]} #{params[:slug]||params[:id]} ".gsub(" ", " ")
54
+ def set_current_ability
55
+ if !current_user
56
+ raise ::CanCan::AccessDenied
81
57
  end
58
+ @current_profile ||= ::Ish::UserProfile.find_by({ email: current_user.email })
59
+ @current_ability ||= ::IshManager::Ability.new( @current_profile )
60
+ end
82
61
 
83
- # @TODO: obsolete, remove _vp_ 2022-10-15
84
- def update_profile_pic
85
- return unless params[:photo]
86
- @photo = Photo.new :photo => params[:photo]
87
- @photo.user_profile = @current_profile
88
- flag = @photo.save
89
- @resource.profile_photo = @photo
90
- flagg = @resource.save
91
- if flag && flagg
92
- flash[:notice] = 'Success'
93
- else
94
- flash[:alert] = "No Luck. #{@photo.errors.messages} #{@resource.errors.messages}"
95
- end
96
- end
62
+ def set_jwt
63
+ @jwt_token = encode(user_profile_id: @current_user.profile.id.to_s)
64
+ end
97
65
 
66
+ def set_lists
67
+ @blank_template = Tmpl.new
68
+
69
+ @email_actions_list = [[nil,nil]] + Office::EmailAction.all.map { |a| [ a.slug, a.id ] }
70
+ @email_templates_list = [[nil,nil]] + Ish::EmailTemplate.all.map { |t| [ t.slug, t.id ] }
71
+ @galleries_list = Gallery.all.list
72
+ @leads_list = Lead.list
73
+ @leadsets_list = Leadset.list
74
+ @locations_list = ::Gameui::Map.list
75
+ @maps_list = ::Gameui::Map.list # @TODO: missing nonpublic!
76
+ @profiles_list = Ish::UserProfile.list
77
+ @reports_list = Report.all.list
78
+ @user_profiles_list = Ish::UserProfile.list
79
+ @videos_list = Video.all.list
98
80
  end
81
+
82
+ def set_title
83
+ @page_title = "#{ params[:controller].gsub('ish_manager/', '') } #{params[:action]} #{params[:slug]||params[:id]} ".gsub(" ", " ")
84
+ end
85
+
86
+ # @TODO: obsolete, remove _vp_ 2022-10-15
87
+ def update_profile_pic
88
+ return unless params[:photo]
89
+ @photo = Photo.new :photo => params[:photo]
90
+ @photo.user_profile = @current_profile
91
+ flag = @photo.save
92
+ @resource.profile_photo = @photo
93
+ flagg = @resource.save
94
+ if flag && flagg
95
+ flash[:notice] = 'Success'
96
+ else
97
+ flash[:alert] = "No Luck. #{@photo.errors.messages} #{@resource.errors.messages}"
98
+ end
99
+ end
100
+
99
101
  end
@@ -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
@@ -5,7 +5,7 @@ class IshManager::NewsitemsController < IshManager::ApplicationController
5
5
 
6
6
  def create
7
7
  @newsitem = Newsitem.new params[:newsitem].permit!
8
- @resource ||= Ish::UserProfile.find params[:newsitem][:user_profile_id] if !params[:newsitem][:user_profile_id].blank?
8
+ @resource ||= Ish::UserProfile.find params[:newsitem][:profile_id] if !params[:newsitem][:profile_id].blank?
9
9
  @resource ||= ::Gameui::Map.find params[:newsitem][:map_id] if !params[:newsitem][:map_id].blank?
10
10
  @resource.newsitems << @newsitem
11
11
  @resource.touch
@@ -6,11 +6,14 @@ class IshManager::UserProfilesController < IshManager::ApplicationController
6
6
  def index
7
7
  @user_profiles = Ish::UserProfile.all
8
8
  authorize! :index, Ish::UserProfile
9
+ if params[:q]
10
+ @user_profiles = @user_profiles.where({ :email => /#{params[:q]}/i })
11
+ end
9
12
  end
10
13
 
11
14
  def show
12
- @user_profile = Ish::UserProfile.find params[:id]
13
- authorize! :show, @user_profile
15
+ @profile = Ish::UserProfile.find params[:id]
16
+ authorize! :show, @profile
14
17
  end
15
18
 
16
19
  def edit
@@ -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
@@ -26,10 +26,14 @@
26
26
  %li= link_to 'Categories & Tags', categories_path
27
27
  %ul
28
28
  %li= link_to '+Newsitem', new_newsitem_path
29
- %li= link_to 'Ish::UserProfiles', user_profiles_path
29
+ %li
30
+ = link_to 'Ish::UserProfiles', user_profiles_path
31
+ .inline-search
32
+ = form_tag user_profiles_path, method: :get do
33
+ = text_field_tag :q
30
34
  %li= link_to "Ish::ImageAsset's", image_assets_path
31
35
  %li
32
- = link_to 'Locations (maps)', maps_path
36
+ = link_to 'Locations', maps_path
33
37
  .inline-search
34
38
  = form_tag maps_path, method: :get do
35
39
  = text_field_tag :q
@@ -0,0 +1,4 @@
1
+
2
+ %p Stock alert:
3
+
4
+ %p= @watch.inspect
@@ -54,6 +54,8 @@
54
54
 
55
55
  .my-actions.hide
56
56
  = render 'ish_manager/email_contexts/form_reply', lead: lead
57
+ .bordered-card
58
+ = render 'ish_manager/email_contexts/form', ctx: Ctx.new({ lead_id: lead.id, email_template: Tmpl.blank_template, from_email: msg.to, subject: msg.subject, body: (msg.part_html||msg.part_txt) }), lead: lead
57
59
  -# = button_to 'Reply'
58
60
  -# = button_to 'Reply All'
59
61
  -# = button_to 'New Template'
@@ -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
+
@@ -2,6 +2,7 @@
2
2
  .item{ style: "display: flex; flex-direction: column;" }
3
3
  = render 'map_meta_row', map: map
4
4
  - if map.childs.length > 0
5
+ .collapse-expand{ id: map.id.to_s } <e>
5
6
  %ul{ style: "margin-left: 5em;" }
6
7
  - map.childs.each do |m|
7
8
  %li
@@ -2,10 +2,11 @@
2
2
  -# ish_manager / maps / index.haml
3
3
  -#
4
4
 
5
- .maps-index
6
- %h1
7
- Maps (#{@maps.length})
8
- = link_to '[+]', new_map_path
5
+ .maps-index.padded
6
+ .header
7
+ %h1.title
8
+ Maps (#{@maps.length})
9
+ = link_to '[+]', new_map_path
9
10
 
10
11
  .red-border
11
12
  = form_tag import_map_path, :multipart => true do
@@ -15,11 +16,12 @@
15
16
  = check_box_tag :delete_existing
16
17
  = submit_tag 'Import Map'
17
18
 
18
- - @maps.each do |map|
19
- = render 'index_item', map: map
19
+ .collapse-expand#collapseExpandMapsIndex Maps
20
+ .a
21
+ - @maps.each do |map|
22
+ = render 'index_item', map: map
20
23
 
21
-
22
- %h1 All Maps (#{@all_maps.length})
24
+ .collapse-expand#collapseExpandMapsIndex2 All Maps (#{@all_maps.length})
23
25
  %ul
24
26
  - @all_maps.each do |m|
25
27
  %li
@@ -8,6 +8,9 @@
8
8
  .field
9
9
  = f.label :map
10
10
  = f.select :map_id, options_for_select( @maps_list, selected:( newsitem[:map_id] || params[:map_id] ) ), {}, class: 'select2'
11
+ .field
12
+ = f.label :profile
13
+ = f.select :profile_id, options_for_select( @profiles_list, selected: newsitem[:profile_id] ), {}, class: 'select2'
11
14
  .col-sm-6
12
15
  = f.submit :submit
13
16
 
@@ -0,0 +1 @@
1
+ app/views/ish_manager/newsitems/_item.haml
@@ -1,5 +1,5 @@
1
1
 
2
- .newsitems-new
2
+ .newsitems-new.max-width
3
3
  %h1
4
4
  New Newsitem
5
5
  = render 'form', :newsitem => @newsitem
@@ -1,4 +1,6 @@
1
1
 
2
- %h5 Editing profile for: `#{@profile.email}`
2
+ .user-profiles-edit.max-width
3
+ .header
4
+ %h2.title Editing profile for: `#{@profile.email}`
3
5
 
4
- = render 'form', :profile => @profile
6
+ = render 'form', :profile => @profile
@@ -10,5 +10,5 @@
10
10
  - @user_profiles.each do |profile|
11
11
  %li
12
12
  = link_to '[~]', edit_user_profile_path(profile)
13
- = profile.email
13
+ = link_to profile.email, user_profile_path(profile)
14
14
 
@@ -1,15 +1,16 @@
1
1
 
2
- .user-profiles--show
3
- %ul
4
- %li
5
- User profile: #{@user_profile.inspect}
6
- %li
7
- Purchased Items:
8
- %ul
9
- - @user_profile.premium_purchases.each do |purchase|
10
- %li
11
- = purchase.item_type.constantize.find(purchase.item_id).inspect
12
- -## this doesn't work b/c an unlocked map has no city.
13
- -# = render 'ish_manager/reports/show_mini', report: purchase.item_type.constantize.find(purchase.item_id)
2
+ .user-profiles-show.max-width
3
+ .header
4
+ %h2.title Profile #{@profile.email}
14
5
 
6
+ .newsitems
7
+ .title Newsitems (#{@profile.newsitems.length})
8
+ - @profile.newsitems.each do |newsitem|
9
+ = render 'ish_manager/newsitems/show', newsitem: newsitem
15
10
 
11
+ .premium-purchases
12
+ Payments (purchased items) (#{@profile.payments.length}):
13
+ - @profile.payments.each do |payment|
14
+ .Card.item
15
+ = payment.inspect
16
+ = payment.item&.inspect
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.397
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-28 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
@@ -521,6 +524,7 @@ files:
521
524
  - app/views/ish_manager/newsitems/_header.haml
522
525
  - app/views/ish_manager/newsitems/_index.haml
523
526
  - app/views/ish_manager/newsitems/_item.haml
527
+ - app/views/ish_manager/newsitems/_show.haml
524
528
  - app/views/ish_manager/newsitems/edit.haml
525
529
  - app/views/ish_manager/newsitems/index.haml
526
530
  - app/views/ish_manager/newsitems/new.haml