ish_manager 0.1.8.356 → 0.1.8.357

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: ce753c6d6bafa14c05b39e77a6d98f61984caff8cb6380d64b837bd48a0e6e28
4
- data.tar.gz: aa7c9068d5a70d26f101317406234cabe535d13d32f0391b1fe9beca97297726
3
+ metadata.gz: 76cc27a494947841dfe406703bd47dc759864338a4ff20d4e140f990136ed87c
4
+ data.tar.gz: fd94bcd0eb392cf1d66785b710488c822339d058ca20729849905cd3c40fe7a1
5
5
  SHA512:
6
- metadata.gz: f3800cd35e62cb88fb79f48b6b9b88037be8c91c00dadd74cd95fb02504e927a750f03211b9ff920598947db195a858356fb6f482ebe7b60bdf7802a7c71bc17
7
- data.tar.gz: 6628e0f557aec949d0ec7910c0f0c9e4462804301a6d0e8bc4d850d5398338afc44388c91417293e48c021e3e7d9f307d078726beb14585d49c802286f9f0164
6
+ metadata.gz: 6945c3b629c8d6ad8cff0aea1c139611dd3665e59278109762be0ce52433ab0e6ee550073787a6b7acd38e92ca562b71f3b833ab2feeb93d4d830594601546e7
7
+ data.tar.gz: d5c953475df34ced1be74b808444646755a4069314e0823f8186a0cd814382606abb1838b9daf8a5ebf9441309cbdae7d3fb7bfc3168b114f0f51db4ddf591f9
@@ -22,6 +22,7 @@
22
22
  //= require ish_manager/maps
23
23
  //= require ish_manager/email_contexts
24
24
  //= require ish_manager/email_templates
25
+ //= require ish_manager/galleries
25
26
 
26
27
  $(function () {
27
28
 
@@ -0,0 +1,78 @@
1
+
2
+ const AppRouter = {
3
+ gallery_update_ordering_path: ({ id, slug }) => `/manager/galleries/${slug || id}/update_ordering`,
4
+ }
5
+ $(document).ready(function () {
6
+
7
+ if ( $(".orderable-items").length ) {
8
+ if ($(".orderable-items").length > 1) {
9
+ logg("There are many .orderable-items! This was only meant to work with one.")
10
+ }
11
+ // let slug = $( $(".orderable-items")[0] ).data('slug')
12
+ let id = $( $(".orderable-items")[0] ).data('id')
13
+ let token = $( $(".orderable-items")[0] ).data('token')
14
+
15
+ $(".orderable-items .items > div").each(function (idx, item) {
16
+ let $el = $(this)
17
+
18
+ $(this).find('a.mvLeft').click(function() {
19
+ // move element up one step
20
+ if ($el.not(':first-child'))
21
+ $el.prev().before($el);
22
+ })
23
+
24
+ $(this).find('a.mvRight').click(function() {
25
+ // move element down one step
26
+ if ($el.not(':last-child'))
27
+ $el.next().after($el);
28
+ })
29
+
30
+ })
31
+ $(".save-ordering").click(function() {
32
+
33
+ let els = $(this).parent().find(".items .item")
34
+ let ids = []
35
+ $(els).map((idx, item) => {
36
+ ids.push( $(item).data('id') )
37
+ })
38
+
39
+ $.ajax({
40
+ type: 'PATCH',
41
+ url: AppRouter.gallery_update_ordering_path({ id: id }),
42
+ data: {
43
+ authenticity_token: token,
44
+ gallery: {
45
+ sorted_photo_ids: ids,
46
+ },
47
+ },
48
+ success: (e) => {
49
+ logg('success')
50
+ },
51
+
52
+ })
53
+
54
+ logg('ok')
55
+ })
56
+ }
57
+
58
+ })
59
+
60
+ /*
61
+ //element to move
62
+ var $el = $(selector);
63
+
64
+ //move element down one step
65
+ if ($el.not(':last-child'))
66
+ $el.next().after($el);
67
+
68
+ //move element up one step
69
+ if ($el.not(':first-child'))
70
+ $el.prev().before($el);
71
+
72
+ //move element to top
73
+ $el.parent().prepend($el);
74
+
75
+ //move element to end
76
+ $el.parent().append($el);
77
+ */
78
+
@@ -55,3 +55,13 @@ div.galleries-show {
55
55
  }
56
56
  }
57
57
  }
58
+
59
+
60
+ .orderable-items {
61
+ .item {
62
+ border: 1px solid red;
63
+ padding: 10px;
64
+
65
+ max-width: Min(125px, 30vw);
66
+ }
67
+ }
@@ -1,7 +1,7 @@
1
1
  class IshManager::GalleriesController < IshManager::ApplicationController
2
2
 
3
3
  before_action :set_lists
4
- before_action :set_gallery, only: %w|destroy edit j_show show update|
4
+ before_action :set_gallery, only: %w|destroy edit j_show show update update_ordering|
5
5
 
6
6
  # alphabetized! : )
7
7
 
@@ -86,22 +86,37 @@ class IshManager::GalleriesController < IshManager::ApplicationController
86
86
 
87
87
  def show
88
88
  authorize! :show, @gallery
89
- @photos = @gallery.photos.unscoped.where({ :is_trash => false })
90
- @deleted_photos = @gallery.photos.unscoped.where({ :is_trash => true })
89
+ @photos = @gallery.photos.unscoped.where({ :is_trash => false }).order_by( ordering: :asc )
90
+ @deleted_photos = @gallery.photos.unscoped.where({ :is_trash => true }).order_by( ordering: :asc )
91
+ end
92
+
93
+ def update_ordering
94
+ authorize! :update, @gallery
95
+ out = []
96
+ params[:gallery][:sorted_photo_ids].each_with_index do |id, idx|
97
+ out.push Photo.find( id ).update_attribute( :ordering, idx )
98
+ end
99
+ flash[:notice] = "Outcomes: #{out}."
100
+ redirect_to action: 'show', id: @gallery.id
91
101
  end
92
102
 
93
103
  def update
94
104
  old_shared_profile_ids = @gallery.shared_profiles.map(&:id)
95
105
  authorize! :update, @gallery
96
106
 
97
- params[:gallery][:shared_profiles].delete('')
107
+ if params[:gallery][:shared_profiles].present?
108
+ params[:gallery][:shared_profiles].delete('')
109
+ end
98
110
  params[:gallery][:shared_profile_ids] = params[:gallery][:shared_profiles]
99
111
  params[:gallery].delete :shared_profiles
100
112
 
101
- if @gallery.update_attributes( params[:gallery].permit! )
102
- new_shared_profiles = Ish::UserProfile.find( params[:gallery][:shared_profile_ids]
103
- ).select { |p| !old_shared_profile_ids.include?( p.id ) }
104
- ::IshManager::ApplicationMailer.shared_galleries( new_shared_profiles, @gallery ).deliver
113
+ flag = @gallery.update_attributes( params[:gallery].permit! )
114
+ if flag
115
+ if params[:gallery][:shared_profile_ids].present?
116
+ new_shared_profiles = Ish::UserProfile.find( params[:gallery][:shared_profile_ids]
117
+ ).select { |p| !old_shared_profile_ids.include?( p.id ) }
118
+ ::IshManager::ApplicationMailer.shared_galleries( new_shared_profiles, @gallery ).deliver
119
+ end
105
120
  flash[:notice] = 'Success.'
106
121
  redirect_to edit_gallery_path(@gallery)
107
122
  else
@@ -1,7 +1,7 @@
1
1
 
2
2
  module IshManager
3
3
  class ApplicationMailer < ActionMailer::Base
4
- default from: '314658@gmail.com'
4
+ default from: 'WasyaCo Consulting <no-reply@wasya.co>'
5
5
  layout 'mailer'
6
6
 
7
7
  def shared_galleries profiles, gallery
@@ -1,6 +1,7 @@
1
1
 
2
2
  class IshManager::MeetingMailer < IshManager::ApplicationMailer
3
- default from: 'piousbox@gmail.com'
3
+ default from: 'WasyaCo Consulting <no-reply@wasya.co>'
4
+
4
5
  # layout 'mailer'
5
6
 
6
7
  def morning_reminder meeting_id:
@@ -1,5 +1,6 @@
1
1
 
2
2
  class IshManager::OfficeMailer < IshManager::ApplicationMailer
3
+ default from: 'WasyaCo Consulting <no-reply@wasya.co>'
3
4
 
4
5
  def send_campaign_email campaign_id, c_lead_id
5
6
  @ctx = @campaign = ::Ish::EmailContext.find campaign_id
@@ -82,7 +83,7 @@ class IshManager::OfficeMailer < IshManager::ApplicationMailer
82
83
  end
83
84
 
84
85
 
85
- ## 2022-11-10 backup
86
+ ## 2022-11-10 _vp_ backup
86
87
  # def send_context_email ctx_id
87
88
  # @email_ctx = ::Ish::EmailContext.find ctx_id
88
89
  # template = "render/_#{@email_ctx.email_template.slug}"
@@ -14,15 +14,12 @@
14
14
  .field
15
15
  %label Slug
16
16
  = f.text_field :slug
17
- -# .field
18
- -# %label Lead
19
- -# = f.select :lead_id, options_for_select( @leads_list, selected: act.lead_id ), {}, class: 'select2'
17
+ .field
18
+ %label Descr
19
+ = f.text_area :descr
20
20
  .field
21
21
  %label Template
22
22
  = f.select :email_template_id, options_for_select( @email_templates_list, selected: act.email_template_id ), {}, class: 'select2'
23
- -# .field
24
- -# %label State
25
- -# = f.select :state, options_for_select( ::Office::EmailAction::STATES, selected: act.state )
26
23
 
27
24
  .col-md-6
28
25
  .field
@@ -40,3 +37,16 @@
40
37
  .row
41
38
  .col-sm-6
42
39
  = f.submit :submit
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+ -# .field
48
+ -# %label State
49
+ -# = f.select :state, options_for_select( ::Office::EmailAction::STATES, selected: act.state )
50
+ -# .field
51
+ -# %label Lead
52
+ -# = f.select :lead_id, options_for_select( @leads_list, selected: act.lead_id ), {}, class: 'select2'
@@ -8,15 +8,17 @@
8
8
 
9
9
  %table.bordered
10
10
  %tr
11
- %th &nbsp;
11
+ %th= check_box_tag 'abba'
12
12
  %th actions
13
13
  %th slug
14
+ %th descr
14
15
  %th next actions
15
16
  - @email_actions.each do |act|
16
17
  %tr
17
- %td [_]
18
+ %td= check_box_tag 'abba'
18
19
  %td= link_to '[~]', edit_email_action_path( act )
19
20
  %td= act.slug
21
+ %td= act.descr
20
22
  -# %td= act.lead&.email
21
23
  %td
22
24
  %ul
@@ -7,7 +7,7 @@
7
7
  .col-md-4
8
8
  %ul
9
9
  %li <b>From:</b> #{@ctx.from_email}
10
- %li <b>To Lead:</b> #{@ctx.lead.email}
10
+ %li <b>To Lead:</b> #{@ctx.lead_id ? @ctx.lead.email : '-'}
11
11
  %li <b>Subject:</b> #{@ctx.subject}
12
12
 
13
13
  .col-md-4
@@ -23,6 +23,9 @@
23
23
  .field.field-subject
24
24
  = f.label :subject
25
25
  = f.text_field :subject
26
+ .field
27
+ = f.label :preview_str
28
+ = f.text_field :preview_str
26
29
 
27
30
  .tab-labels
28
31
  %a.label-raw{ href: "javascript: void(0)", data: { ref: '.tab-raw' } } Raw
@@ -13,7 +13,7 @@
13
13
  <meta charset="UTF-8">
14
14
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
15
15
  <meta name="viewport" content="width=device-width, initial-scale=1">
16
- <title>*|MC:SUBJECT|*</title>
16
+ <title><%= @ctx.preview_str %></title>
17
17
 
18
18
  <style type="text/css">
19
19
  .mcnTextBlock {
@@ -839,12 +839,11 @@ h4 {
839
839
 
840
840
  <body>
841
841
 
842
- <!--*|IF:MC_PREVIEW_TEXT|*-->
843
- <!--[if !gte mso 9]><span class="mcnPreviewText"
844
- style="display:none; font-size:0px; line-height:0px; max-height:0px; max-width:0px; opacity:0; overflow:hidden; visibility:hidden; mso-hide:all;"
845
- >*|MC_PREVIEW_TEXT|*</span>
842
+
843
+ <!--[if !gte mso 9]>-->
844
+ <span class="mcnPreviewText" style="display:none; font-size:0px; line-height:0px; max-height:0px; max-width:0px; opacity:0; overflow:hidden; visibility:hidden; mso-hide:all;"
845
+ ><%= @ctx.preview_str %></span>
846
846
  <!--<![endif]-->
847
- <!--*|END:IF|*-->
848
847
 
849
848
  <center>
850
849
  <table align="center" border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" id="bodyTable">
@@ -22,7 +22,16 @@
22
22
 
23
23
  .row-thumbs
24
24
  %p.collapse-expand#rowThumbs Thumbs
25
- = render 'ish_manager/photos/index_thumbs', photos: @photos
25
+ .orderable-items{ data: { id: @gallery.id.to_s, slug: @gallery.slug, token: form_authenticity_token } }
26
+ .flex-row.items
27
+ - @photos.each do |photo|
28
+ .itemW
29
+ %a.mvLeft &lt;
30
+ %a.mvRight &gt;
31
+ .item{ data: { id: photo.id.to_s } }
32
+ = render 'ish_manager/photos/meta_manager', photo: photo
33
+ = image_tag photo.photo.url( :thumb )
34
+ = button_tag 'Save ordering', class: 'save-ordering'
26
35
 
27
36
  .row-large
28
37
  %p.collapse-expand#rowLarge Large
@@ -1,6 +1,6 @@
1
1
 
2
2
  .photos--index-thumbs
3
- .flex-row
3
+ .flex-row.items
4
4
  - photos.each do |photo|
5
5
  .item
6
6
  = render 'ish_manager/photos/meta_manager', photo: photo
data/config/routes.rb CHANGED
@@ -5,6 +5,7 @@ IshManager::Engine.routes.draw do
5
5
 
6
6
  get 'categories', to: 'categories#index'
7
7
 
8
+ patch 'galleries/:id/update_ordering', to: 'galleries#update_ordering'
8
9
  get 'galleries', :to => 'galleries#index', :defaults => { :render_type => Gallery::RENDER_THUMBS }
9
10
  get 'galleries/index_titles', :to => 'galleries#index', :defaults => { :render_type => Gallery::RENDER_TITLES }
10
11
  get 'galleries/index_thumbs', :to => 'galleries#index', :defaults => { :render_type => Gallery::RENDER_THUMBS }
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.356
4
+ version: 0.1.8.357
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-07 00:00:00.000000000 Z
11
+ date: 2023-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -235,6 +235,7 @@ files:
235
235
  - app/assets/javascripts/ish_manager/application.js
236
236
  - app/assets/javascripts/ish_manager/email_contexts.js
237
237
  - app/assets/javascripts/ish_manager/email_templates.js
238
+ - app/assets/javascripts/ish_manager/galleries.js
238
239
  - app/assets/javascripts/ish_manager/maps.js
239
240
  - app/assets/javascripts/ish_manager/shared.js
240
241
  - app/assets/javascripts/ish_manager/trash/application_materialize.js