ish_manager 0.1.8.396 → 0.1.8.399

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: 5034dd112f0ee344e5047b4426a62fc394e81c6441c5eda3e88d974e89dd4bcc
4
- data.tar.gz: 92a0814dce985b58655b2d0378690ea65c8846b9b0966908c3327965a4104606
3
+ metadata.gz: ab3eb4ae2c3ce1d114b30a3327dcb37631d38599df86c5e12dbe4cc1ce0fd44a
4
+ data.tar.gz: 109c4fe36fc77458ea0fbfdd6615e1264a2985116f16b5466ef1d3594fde8b9c
5
5
  SHA512:
6
- metadata.gz: f0432554e32ef99a1468bda9cbd4b78ebcddb80cc6329c325a0370c39b510ab04569138510c88a9f548f981bf757460ea7a3e3330d66d2a3a7fc1f6edbed958a
7
- data.tar.gz: 62dad8ef2f776f21ad42a04bb1edb681a9e65872f04e3d314062dd3cd5b0e85e0362cabae277ccb7a76c30b029d762f4a52eb1636413d1c21459199aebb25a48
6
+ metadata.gz: 0e262ac280849d4fab6fcb951224a813d9664e097b2a28b11399d380d145f6f8d4623b086702b3898c60d553270e230f09874093f56647ac994a2cb5e0056338
7
+ data.tar.gz: 1a684d88b90fc52f9ceac39bf4380eb57153f48c653c0e4eefa711e9e47306eed8b5ae5af4c5d007bfdab2b7074fd0f7a63ce8a08baf0073e48b97b41bed977a
@@ -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
@@ -0,0 +1,52 @@
1
+
2
+ class IshManager::EventsController < ::IshManager::ApplicationController
3
+
4
+ def create
5
+ authorize! :manage, Ish::Event
6
+ @event = Ish::Event.create( params[:event].permit! )
7
+ if @event.persisted?
8
+ flash[:notice] = "Success."
9
+ redirect_to action: 'index'
10
+ else
11
+ flash[:alert] = "No luck: #{@event.errors.full_messages.join(', ')}."
12
+ render 'new'
13
+ end
14
+ end
15
+
16
+ def edit
17
+ authorize! :manage, Ish::Event
18
+ @event = Ish::Event.find params[:id]
19
+ end
20
+
21
+ def index
22
+ authorize! :manage, Ish::Event
23
+ @events = Ish::Event.all
24
+ if params[:q]
25
+ @events = @events.where({ :name => /#{params[:q]}/i })
26
+ end
27
+ end
28
+
29
+ def new
30
+ authorize! :manage, Ish::Event
31
+ @event = Ish::Event.new
32
+ end
33
+
34
+ def show
35
+ authorize! :manage, Ish::Event
36
+ @event = Ish::Event.find params[:id]
37
+ end
38
+
39
+ def update
40
+ authorize! :manage, Ish::Event
41
+ @event = Ish::Event.find params[:id]
42
+ @event.update_attributes( params[:event].permit! )
43
+ if @event.persisted?
44
+ flash[:notice] = "Success."
45
+ redirect_to action: 'index'
46
+ else
47
+ flash[:alert] = "No luck: #{@event.errors.full_messages.join(', ')}."
48
+ render 'edit'
49
+ end
50
+ end
51
+
52
+ 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
@@ -26,14 +26,25 @@
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
36
40
  = link_to '[+]', new_map_path
41
+ %ul
42
+ %li
43
+ = link_to 'Events', events_path
44
+ .inline-search
45
+ = form_tag events_path, method: :get do
46
+ = text_field_tag :q
47
+ = link_to '[+]', new_event_path
37
48
  .c
38
49
 
39
50
  %i.fa.fa-compress.collapse-expand#collapseHeaderOffice
@@ -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,18 @@
1
+
2
+ - url = event.new_record? ? events_path : event_path(event)
3
+ .events--form
4
+ = form_for event, as: :event, url: url do |f|
5
+ .field
6
+ = f.label :start_at
7
+ = f.text_field :start_at
8
+ .field
9
+ = f.label :end_at
10
+ = f.text_field :end_at
11
+ .field
12
+ = f.label :name
13
+ = f.text_field :name
14
+ .field
15
+ = f.label :descr
16
+ = f.text_field :descr
17
+ .actions
18
+ = f.submit
@@ -0,0 +1,5 @@
1
+
2
+ .events-edit.max-width
3
+ .header
4
+ .title Edit event
5
+ = render 'form', event: @event
@@ -0,0 +1,11 @@
1
+
2
+ .events-index.max-width
3
+ .header
4
+ .title Events
5
+
6
+ - @events.each do |event|
7
+ .a
8
+ = pp_date event.start_at
9
+ = event.name
10
+ = link_to '[~]', edit_event_path(event)
11
+
@@ -0,0 +1,5 @@
1
+
2
+ .events-new.max-width
3
+ .header
4
+ .title New event
5
+ = render 'form', event: @event
File without changes
@@ -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
@@ -5,6 +5,8 @@ IshManager::Engine.routes.draw do
5
5
 
6
6
  get 'categories', to: 'categories#index'
7
7
 
8
+ resources 'events'
9
+
8
10
  patch 'galleries/:id/update_ordering', to: 'galleries#update_ordering'
9
11
  get 'galleries', :to => 'galleries#index', :defaults => { :render_type => Gallery::RENDER_THUMBS }
10
12
  get 'galleries/index_titles', :to => 'galleries#index', :defaults => { :render_type => Gallery::RENDER_TITLES }
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.396
4
+ version: 0.1.8.399
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-27 00:00:00.000000000 Z
11
+ date: 2023-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -316,6 +316,7 @@ files:
316
316
  - app/controllers/ish_manager/email_messages_controller.rb
317
317
  - app/controllers/ish_manager/email_templates_controller.rb
318
318
  - app/controllers/ish_manager/email_unsubscribes_controller.rb
319
+ - app/controllers/ish_manager/events_controller.rb
319
320
  - app/controllers/ish_manager/galleries_controller.rb
320
321
  - app/controllers/ish_manager/image_assets_controller.rb
321
322
  - app/controllers/ish_manager/invoices_controller.rb
@@ -451,6 +452,11 @@ files:
451
452
  - app/views/ish_manager/email_templates/plain.html.erb-trash
452
453
  - app/views/ish_manager/email_templates/show.haml
453
454
  - app/views/ish_manager/email_unsubscribes/new.haml
455
+ - app/views/ish_manager/events/_form.haml
456
+ - app/views/ish_manager/events/edit.haml
457
+ - app/views/ish_manager/events/index.haml
458
+ - app/views/ish_manager/events/new.haml
459
+ - app/views/ish_manager/events/show.haml
454
460
  - app/views/ish_manager/galleries/_form.haml
455
461
  - app/views/ish_manager/galleries/_index.haml
456
462
  - app/views/ish_manager/galleries/_index_title.haml
@@ -515,6 +521,7 @@ files:
515
521
  - app/views/ish_manager/newsitems/_header.haml
516
522
  - app/views/ish_manager/newsitems/_index.haml
517
523
  - app/views/ish_manager/newsitems/_item.haml
524
+ - app/views/ish_manager/newsitems/_show.haml
518
525
  - app/views/ish_manager/newsitems/edit.haml
519
526
  - app/views/ish_manager/newsitems/index.haml
520
527
  - app/views/ish_manager/newsitems/new.haml