sinatra-hexacta 0.3.3 → 0.3.8
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 +4 -4
- data/lib/sinatra/extensions/generalmailnolink.rb +24 -0
- data/lib/sinatra/extensions/mailbuilder.rb +15 -6
- data/lib/sinatra/helpers/init.rb +0 -1
- data/lib/sinatra/public/js/app.js +2 -2
- data/lib/sinatra/views/inputs/input.slim +13 -2
- data/lib/sinatra/views/inputs/textarea.slim +4 -2
- data/lib/sinatra/views/notifications/new.slim +1 -1
- data/lib/sinatra/views/reports/pick_date.slim +1 -1
- data/lib/sinatra/views/reports/pick_dates.slim +1 -1
- data/lib/sinatra/views/reports/pick_month.slim +1 -1
- data/lib/sinatra/views/reports/pick_year.slim +1 -1
- metadata +2 -2
- data/lib/sinatra/helpers/subscriptions.rb +0 -44
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ade8d77e4a11dd25fac0d078c8c80956e6969beaa4cad5745f6f75720d146966
|
4
|
+
data.tar.gz: dae2ef0fe98be2e088b40dec42901d1d012a077815dc10e64e90fdbecfe53a49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd319e6461b25be1994ed4a2d6a3c1f3b39dfe6a722952ce4b2ac239568f2a56b1cfa2020d181d652da50caf0606fb8da31cec5bb292385aef55b731c5f5c7ef
|
7
|
+
data.tar.gz: a4a78b99e4763ea4e8f51c1304ea9063ceff8700a01bbabed082452144d87f79558849faa48db62a51e002eac4902c0504a85ef67c3157ea90fb069da431e9da
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
class GeneralMailNoLink < Mail
|
3
|
+
|
4
|
+
def initialize(args)
|
5
|
+
super(args)
|
6
|
+
@subject = args[:subject]
|
7
|
+
@description = args[:description]
|
8
|
+
end
|
9
|
+
|
10
|
+
def template
|
11
|
+
'general_no_link'
|
12
|
+
end
|
13
|
+
|
14
|
+
def subject
|
15
|
+
@subject
|
16
|
+
end
|
17
|
+
|
18
|
+
def values
|
19
|
+
data = {}
|
20
|
+
data["{description}"] = @description
|
21
|
+
data
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -28,11 +28,20 @@ class MailBuilder
|
|
28
28
|
|
29
29
|
def send
|
30
30
|
@from ||= "apps@hexacta.com"
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
31
|
+
if @link.nil?
|
32
|
+
GeneralMailNoLink.new({ :to => @to,
|
33
|
+
:from => @from,
|
34
|
+
:subject => @subject,
|
35
|
+
:description => @description
|
36
|
+
}).send
|
37
|
+
else
|
38
|
+
GeneralMail.new({ :to => @to,
|
39
|
+
:from => @from,
|
40
|
+
:subject => @subject,
|
41
|
+
:description => @description,
|
42
|
+
:link => @link
|
43
|
+
}).send
|
44
|
+
|
45
|
+
end
|
37
46
|
end
|
38
47
|
end
|
data/lib/sinatra/helpers/init.rb
CHANGED
@@ -36,7 +36,7 @@ $(document).ready(function(){
|
|
36
36
|
}
|
37
37
|
});
|
38
38
|
if ($(this).find('.error').length == 0 ) {
|
39
|
-
$(this).find('
|
39
|
+
$(this).find(':submit').attr('disabled','disabled');
|
40
40
|
}
|
41
41
|
});
|
42
42
|
|
@@ -469,7 +469,7 @@ $(document).ready(function(){
|
|
469
469
|
* Modal hide
|
470
470
|
*/
|
471
471
|
$('.modal').bind('shown.bs.modal', function (e) {
|
472
|
-
$(this).find('
|
472
|
+
$(this).find(':submit').attr("disabled",false);
|
473
473
|
});
|
474
474
|
|
475
475
|
});
|
@@ -4,15 +4,26 @@
|
|
4
4
|
- id = "#{name}_#{rand(1000)}"
|
5
5
|
- unless defined? placeholder
|
6
6
|
- placeholder = "..."
|
7
|
+
-unless defined? onkeyup
|
8
|
+
-onkeyup = ''
|
9
|
+
-unless defined? readonly
|
10
|
+
-readonly = false
|
7
11
|
|
8
12
|
|
9
13
|
-if required
|
10
14
|
.form-group.has-feedback.has-success
|
11
15
|
label #{title}
|
12
16
|
.fg-line
|
13
|
-
|
17
|
+
-if readonly
|
18
|
+
input.form-control.fg-input id="#{id}" type="#{type}" placeholder="#{placeholder}" name="#{name}" required="" value="#{value}" onkeyup="#{onkeyup}" readonly=''
|
19
|
+
-else
|
20
|
+
input.form-control.fg-input id="#{id}" type="#{type}" placeholder="#{placeholder}" name="#{name}" required="" value="#{value}" onkeyup="#{onkeyup}"
|
21
|
+
|
14
22
|
-else
|
15
23
|
.form-group
|
16
24
|
label #{title}
|
17
25
|
.fg-line
|
18
|
-
|
26
|
+
-if readonly
|
27
|
+
input.form-control.fg-input id="#{id}" type="#{type}" placeholder="#{placeholder}" name="#{name}" value="#{value}" onkeyup="#{onkeyup}" readonly=''
|
28
|
+
-else
|
29
|
+
input.form-control.fg-input id="#{id}" type="#{type}" placeholder="#{placeholder}" name="#{name}" value="#{value}" onkeyup="#{onkeyup}"
|
@@ -4,11 +4,13 @@
|
|
4
4
|
- id = "#{name}_#{rand(1000)}"
|
5
5
|
- unless defined? placeholder
|
6
6
|
- placeholder = "Escribe aquí..."
|
7
|
+
- unless defined? rows
|
8
|
+
- rows = 5
|
7
9
|
|
8
10
|
.form-group
|
9
11
|
.fg-line
|
10
12
|
label.fg-label #{title}
|
11
13
|
- if required
|
12
|
-
textarea.form-control name="#{name}" placeholder=("#{placeholder}") rows="
|
14
|
+
textarea.form-control id="#{id}" name="#{name}" placeholder=("#{placeholder}") rows="#{rows}" maxlength="#{length}" required="" #{value}
|
13
15
|
- else
|
14
|
-
textarea.form-control name="#{name}" placeholder=("#{placeholder}") rows="
|
16
|
+
textarea.form-control id="#{id}" name="#{name}" placeholder=("#{placeholder}") rows="#{rows}" maxlength="#{length}" #{value}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-hexacta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marco Zanger
|
@@ -61,6 +61,7 @@ files:
|
|
61
61
|
- lib/sinatra/extensions/antiquity.rb
|
62
62
|
- lib/sinatra/extensions/date.rb
|
63
63
|
- lib/sinatra/extensions/generalmail.rb
|
64
|
+
- lib/sinatra/extensions/generalmailnolink.rb
|
64
65
|
- lib/sinatra/extensions/init.rb
|
65
66
|
- lib/sinatra/extensions/mail.rb
|
66
67
|
- lib/sinatra/extensions/mailbuilder.rb
|
@@ -79,7 +80,6 @@ files:
|
|
79
80
|
- lib/sinatra/helpers/libraries.rb
|
80
81
|
- lib/sinatra/helpers/reports.rb
|
81
82
|
- lib/sinatra/helpers/schedule.rb
|
82
|
-
- lib/sinatra/helpers/subscriptions.rb
|
83
83
|
- lib/sinatra/hexacta.rb
|
84
84
|
- lib/sinatra/public/css/app.min.1.css
|
85
85
|
- lib/sinatra/public/css/app.min.2.css
|
@@ -1,44 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
module Sinatra
|
3
|
-
module SubscriptionHelper
|
4
|
-
|
5
|
-
def notify_to(user,creator,title,message,label,link=nil)
|
6
|
-
notification = Notification.find_or_create(:user_id => user.id,
|
7
|
-
:creator_id => creator.id,
|
8
|
-
:title => title,
|
9
|
-
:message => message,
|
10
|
-
:label => label,
|
11
|
-
:link => link,
|
12
|
-
:creation_date => Date.today)
|
13
|
-
if link.nil?
|
14
|
-
notification.link = "/notifications/#{notification.id}"
|
15
|
-
notification.save
|
16
|
-
end
|
17
|
-
notification
|
18
|
-
end
|
19
|
-
|
20
|
-
def notify(creator,title,message,label,link=nil)
|
21
|
-
Subscription.where(:label => label).all.each do |subscription|
|
22
|
-
notification = notify_to(subscription.user,creator,title,message,label,link)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def notify_error(creator,title,message)
|
27
|
-
Subscription.where(:label => 'error').all.each do |subscription|
|
28
|
-
creator = subscription.user if creator.nil?
|
29
|
-
notification = Notification.find(:user_id => subscription.user_id,
|
30
|
-
:creator_id => creator.id,
|
31
|
-
:title => title,
|
32
|
-
:message => message,
|
33
|
-
:label => 'error',
|
34
|
-
:read_date => nil)
|
35
|
-
if notification.nil?
|
36
|
-
notification = notify_to(subscription.user,creator,title,message,'error')
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
helpers SubscriptionHelper
|
44
|
-
end
|