sinatra-hexacta 0.8.6 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 94878352931180fed716175089275de8178feddbfd3d967864ff1781e6d6ef69
4
- data.tar.gz: 8b51e6e2a13b4f90c56af20b7d35f4928556ad98e29b062ef0e5a78bd67f947b
3
+ metadata.gz: d01dba3c69595538af2e2f7eb23888854e7f285db8995952e86c5617447fa16e
4
+ data.tar.gz: d7e68c96d682075a32375af7239486e8f075e5de5dd3594f543857d41d3b874a
5
5
  SHA512:
6
- metadata.gz: 81abe6f03be0934d7b718e1d952c9bbdfa44f1a35306b8c7fad085d1173e390830f3931de9f143d9a7b2569c224e54818392cc4878cf613e27c5c48109ae5d7d
7
- data.tar.gz: 806507f14e95da83d1e69fa514966c83e92c5cc8d217a1965c44136a923d823070e2901e70ed2c57dca1daefa33f9fd58bb20331f56309cdb6515b813a4be0d0
6
+ metadata.gz: 8aa4f0b5cfbeafbd8b98eeb8a1c9f051324f8767b6ee7a5e9d1968d7b7c6173a7788df0dbe5b53523f7827f4acb90c4cb196ba227583c98572f6d668e0586dec
7
+ data.tar.gz: 5d79803b0860705b4d0289dd4cf1ea081574000e4d7afa7b90001ad901703310c87bd6a09decf333477b3981c69c1117b02fc83eee7b9387c2e2e8fdeff4c755
@@ -7,3 +7,4 @@ require_relative 'mail'
7
7
  require_relative 'generalmail'
8
8
  require_relative 'mailbuilder'
9
9
  require_relative 'processmanager'
10
+ require_relative 'menu'
@@ -0,0 +1,27 @@
1
+ # encoding: utf-8
2
+ class MenuBuilder
3
+
4
+ def initialize
5
+ @elements = []
6
+ end
7
+
8
+ def dropdown(text,icon,submenu)
9
+ @elements << { :type => 'dropdown' , :text => text, :icon => icon, :link => submenu }
10
+ return self
11
+ end
12
+
13
+ def link(text,icon,link,target)
14
+ @elements << { :type => 'link' , :text => text, :icon => icon, :link => link, :target => target }
15
+ return self
16
+ end
17
+
18
+ def modal(text,icon,link)
19
+ @elements << { :type => 'modal' , :text => text, :icon => icon, :link => link }
20
+ return self
21
+ end
22
+
23
+ def build
24
+ @elements
25
+ end
26
+
27
+ end
@@ -56,6 +56,10 @@ class ProcessHandler
56
56
  @interrupted = true
57
57
  end
58
58
 
59
+ def interrupted?
60
+ @interrupted
61
+ end
62
+
59
63
  def running?
60
64
  @total != @performed
61
65
  end
@@ -6,3 +6,4 @@ require_relative 'cas'
6
6
  require_relative 'schedule'
7
7
  require_relative 'alerts'
8
8
  require_relative 'reports'
9
+ require_relative 'menu'
@@ -0,0 +1,15 @@
1
+ # encoding: utf-8
2
+ module Sinatra
3
+ module MenuHelper
4
+ extend Hexacta
5
+
6
+ def menu(option_hash)
7
+ slim "#{Hexacta::GEM_FILE_DIR}/menu/menu".to_sym, locals: option_hash
8
+ end
9
+
10
+ setup_dir("/app/views/#{Hexacta::GEM_FILE_DIR}/menu")
11
+ copy_all_files("/lib/sinatra/views/menu","/app/views/#{Hexacta::GEM_FILE_DIR}/menu")
12
+ end
13
+
14
+ helpers MenuHelper
15
+ end
@@ -10,43 +10,77 @@ class ProcessManager {
10
10
  }
11
11
 
12
12
  static update(progress) {
13
- $("#processes .progress-bar").css("width",progress + "%");
13
+ if ($("#processes .progress").hasClass("active")) {
14
+ $("#processes .progress-bar").css("width",progress + "%");
15
+ }
16
+ }
17
+
18
+ static init() {
19
+ $("#processes .progress-bar").css("width","0%");
20
+ $("#processes .icon").addClass("rotating");
21
+ $("#processes .icon").removeClass("zmdi-check-circle").addClass("zmdi-settings");
22
+ $("#processes .progress").addClass("active");
23
+ $("#processes a").removeClass("hidden");
24
+ $("#processes .progress-bar").removeClass("progress-bar-success").removeClass("progress-bar-warning").removeClass("progress-bar-danger");
25
+ $("#processes .detail").html("Cargando...");
14
26
  }
15
27
 
16
28
  static complete() {
17
29
  $("#processes .progress-bar").css("width","100%");
18
- $("#processes .rotating").removeClass("rotating");
19
- $("#processes .zmdi").removeClass("zmdi-settings").addClass("zmdi-check-circle");
30
+ $("#processes .icon").removeClass("rotating");
31
+ $("#processes .icon").removeClass("zmdi-settings").addClass("zmdi-check-circle");
32
+ $("#processes a").addClass("hidden");
20
33
  $("#processes .progress").removeClass("active");
21
34
  $("#processes .progress-bar").addClass("progress-bar-success");
22
35
  $("#processes .detail").html("Completado. Refresca la pantalla para actualizar la información.");
23
36
  }
24
37
 
38
+ static error() {
39
+ $("#processes .progress-bar").css("width","100%");
40
+ $("#processes .icon").removeClass("rotating");
41
+ $("#processes .icon").removeClass("zmdi-settings").addClass("zmdi-check-circle");
42
+ $("#processes a").addClass("hidden");
43
+ $("#processes .progress").removeClass("active");
44
+ $("#processes .progress-bar").addClass("progress-bar-danger");
45
+ $("#processes .detail").html("Ha ocurrido un error.");
46
+ }
47
+
48
+ static cancel() {
49
+ $("#processes .progress-bar").css("width","100%");
50
+ $("#processes .icon").removeClass("rotating");
51
+ $("#processes a").addClass("hidden");
52
+ $("#processes .progress").removeClass("active");
53
+ $("#processes .progress-bar").addClass("progress-bar-warning");
54
+ $("#processes .detail").html("Proceso cancelado. Refresca la pantalla para actualizar la información.");
55
+ }
56
+
25
57
  static start(clazz) {
58
+ ProcessManager.show(clazz);
26
59
  $.ajax({
27
60
  url: "/process",
28
61
  type: 'POST',
29
62
  data: { class : clazz },
30
63
  success: function(result) {
31
- ProcessManager.show('Cargando...');
32
- ProcessManager.update(0);
64
+ ProcessManager.init();
33
65
  },
34
66
  error: function(error) {
67
+ ProcessManager.error();
35
68
  }
36
69
  });
37
70
  }
38
71
 
39
72
  static start_with_map(clazz,map) {
73
+ ProcessManager.show(clazz);
40
74
  map['class'] = clazz;
41
75
  $.ajax({
42
76
  url: "/process",
43
77
  type: 'POST',
44
78
  data: map,
45
79
  success: function(result) {
46
- ProcessManager.show('Cargando...');
47
- ProcessManager.update(0);
80
+ ProcessManager.init();
48
81
  },
49
82
  error: function(error) {
83
+ ProcessManager.error();
50
84
  }
51
85
  });
52
86
  }
@@ -58,18 +92,28 @@ class ProcessManager {
58
92
  data: { class : clazz },
59
93
  success: function(result) {
60
94
  if (result != "") {
95
+ ProcessManager.show(result.name);
61
96
  if (result.progress >= 100.0) {
62
- //ProcessManager.hide();
63
- ProcessManager.complete()
64
- ProcessManager.cleanProcess(clazz);
65
- } else {
66
- ProcessManager.show(result.name);
97
+ ProcessManager.completeProcess(clazz);
67
98
  }
68
99
  ProcessManager.update(result.progress);
69
-
70
100
  }
71
101
  },
72
102
  error: function(error) {
103
+ ProcessManager.error();
104
+ }
105
+ });
106
+ }
107
+
108
+ static completeProcess(clazz) {
109
+ $.ajax({
110
+ url: "/processes/" + clazz,
111
+ type: 'POST',
112
+ success: function(result) {
113
+ ProcessManager.complete()
114
+ },
115
+ error: function(error) {
116
+ ProcessManager.error();
73
117
  }
74
118
  });
75
119
  }
@@ -79,8 +123,10 @@ class ProcessManager {
79
123
  url: "/processes/" + clazz,
80
124
  type: 'POST',
81
125
  success: function(result) {
126
+ ProcessManager.cancel();
82
127
  },
83
128
  error: function(error) {
129
+ ProcessManager.error();
84
130
  }
85
131
  });
86
132
  }
@@ -1,11 +1,21 @@
1
1
  .row#processes style="height:0px;overflow: hidden;-webkit-transition: all 0.5s ease-in-out;-o-transition: all 0.5s ease-in-out;transition: all 0.5s ease-in-out;"
2
2
  .col-xs-12
3
3
  .progress.progress-striped.active style="height:80px;"
4
+ a.lv-item.p-20.p-absolute style="right: 1%;z-index: 10;" role="button" onclick="clean_process();"
5
+ .media
6
+ .pull-right
7
+ i.zmdi.zmdi-hc-3x.zmdi-close-circle.c-white
4
8
  .progress-bar aria-valuemax="100" aria-valuemin="0" aria-valuenow="0" role="progressbar" style="width: 0%;text-align:left;"
5
- .lv-item.p-20.p-fixed
9
+ .lv-item.p-20.p-absolute
6
10
  .media
7
11
  .pull-left
8
- i.zmdi.zmdi-hc-3x.zmdi-settings.c-white.rotating
12
+ i.zmdi.zmdi-hc-3x.zmdi-settings.c-white.rotating.icon
9
13
  .media-body
10
14
  .lv-title.c-white.title
11
- small.lv-small.c-white.detail Espera por favor...
15
+ small.lv-small.c-white.detail Espera por favor...
16
+
17
+
18
+ javascript:
19
+ function clean_process() {
20
+ console.log("Override 'clean_process' function");
21
+ }
@@ -0,0 +1,42 @@
1
+ .actions-menu.m-b-20
2
+ .btn-group.p-fixed style="border-radius: 5px;z-index:5;"
3
+ -for item in menu
4
+ -if item[:type] == 'dropdown'
5
+ .btn-group
6
+ a.btn.btn-default.dropdown-toggle.waves-effect.btn-icon-text aria-expanded="true" data-toggle="dropdown" type="button"
7
+ i.zmdi class="zmdi-#{item[:icon]}"
8
+ | #{item[:text]}
9
+
10
+ ul.dropdown-menu role="menu" style="border-radius: 5px;"
11
+ -for subitem in item[:link]
12
+ -if subitem[:type] == 'link'
13
+ li
14
+ a.btn-icon-text href="#{subitem[:link]}" target="#{subitem[:target]}"
15
+ i.zmdi class="zmdi-#{subitem[:icon]}"
16
+ | #{subitem[:text]}
17
+
18
+ -if item[:type] == 'link'
19
+ a.btn.btn-default.waves-effect.btn-icon-text type="button" href="#{item[:link]}" target="#{item[:target]}"
20
+ i.zmdi class="zmdi-#{item[:icon]}"
21
+ | #{item[:text]}
22
+
23
+ -if item[:type] == 'modal'
24
+ a.btn.btn-default.waves-effect.btn-icon-text type="button" data-toggle="modal" data-target="#{item[:link]}"
25
+ i.zmdi class="zmdi-#{item[:icon]}"
26
+ | #{item[:text]}
27
+
28
+
29
+ css:
30
+ .actions-menu {
31
+ height: 38px;
32
+ }
33
+ .actions-menu a.btn {
34
+ padding: 10px;
35
+ border-radius: 5px;
36
+ border-left: 1px solid #eee;
37
+ }
38
+
39
+ .actions-menu a:hover {
40
+ background: #2196f3 !important;
41
+ color: white !important;
42
+ }
@@ -1,7 +1,7 @@
1
1
  a.lv-item style="padding:10px 15px;#{notification.pending?? 'background-color: #ECF9FF;' : ''}" role="button" onclick="#{notification.pending?? "read_notify(#{notification.id},'#{notification.link}');this.onclick=\'\'" : ''}" href="#{notification.pending?? '#' : notification.link}"
2
2
  .media
3
3
  .pull-left.text-center.p-r-15
4
- img.lv-img-sm alt="" src="#{Configuration::USER_PHOTO_URL}#{notification.creator.hxt_id}" title="#{notification.creator.full_name}"
4
+ img.lv-img-sm alt="" src="#{Configuration::USER_PHOTO_URL}#{notification.creator.hxt_id}" title="#{notification.creator.full_name}" onError="this.onerror=null;this.src='/sinatra-hexacta/img/noimage.jpg';"
5
5
  br
6
6
  -if notification.label == 'error'
7
7
  .btn.btn-link.bgm-red.btn-xs style="font-size:6pt" #{notification.label}
@@ -5,7 +5,7 @@
5
5
  .card-header
6
6
  .media
7
7
  .pull-left
8
- img.lv-img alt="" src="#{Configuration::USER_PHOTO_URL}#{notification.creator.hxt_id}" title="#{notification.creator.full_name}"
8
+ img.lv-img alt="" src="#{Configuration::USER_PHOTO_URL}#{notification.creator.hxt_id}" title="#{notification.creator.full_name}" onError="this.onerror=null;this.src='/sinatra-hexacta/img/noimage.jpg';"
9
9
  .media-body.m-t-5
10
10
  h2
11
11
  | #{notification.title}
@@ -10,7 +10,7 @@
10
10
  .col-xs-2
11
11
  .card.profile-view
12
12
  .pv-header.bgm-teal style="height:70px;"
13
- img.pv-main style="width: 100px;height: 100px;bottom: -50px;margin-left: -50px;" alt="" src="#{Configuration::USER_PHOTO_URL}#{user.hxt_id}"
13
+ img.pv-main style="width: 100px;height: 100px;bottom: -50px;margin-left: -50px;" alt="" src="#{Configuration::USER_PHOTO_URL}#{user.hxt_id}" onError="this.onerror=null;this.src='/sinatra-hexacta/img/noimage.jpg';"
14
14
  .pv-body style="padding: 0 20px 10px;"
15
15
  h2 style="font-size:14px;font-weight: 500;"
16
16
  | #{user.first_name}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-hexacta
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.6
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Zanger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-04 00:00:00.000000000 Z
11
+ date: 2020-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sucker_punch
@@ -80,6 +80,7 @@ files:
80
80
  - lib/sinatra/extensions/mail.rb
81
81
  - lib/sinatra/extensions/mailbuilder.rb
82
82
  - lib/sinatra/extensions/mailsender.rb
83
+ - lib/sinatra/extensions/menu.rb
83
84
  - lib/sinatra/extensions/notification.rb
84
85
  - lib/sinatra/extensions/processmanager.rb
85
86
  - lib/sinatra/handlers/errors.rb
@@ -94,6 +95,7 @@ files:
94
95
  - lib/sinatra/helpers/init.rb
95
96
  - lib/sinatra/helpers/inputs.rb
96
97
  - lib/sinatra/helpers/libraries.rb
98
+ - lib/sinatra/helpers/menu.rb
97
99
  - lib/sinatra/helpers/reports.rb
98
100
  - lib/sinatra/helpers/schedule.rb
99
101
  - lib/sinatra/hexacta.rb
@@ -203,6 +205,7 @@ files:
203
205
  - lib/sinatra/views/libraries/include_css.slim
204
206
  - lib/sinatra/views/libraries/include_js_after.slim
205
207
  - lib/sinatra/views/libraries/include_js_before.slim
208
+ - lib/sinatra/views/menu/menu.slim
206
209
  - lib/sinatra/views/notifications.slim
207
210
  - lib/sinatra/views/notifications/form.slim
208
211
  - lib/sinatra/views/notifications/item.slim