common_functions 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/common_functions.rb +3 -39
- data/lib/common_functions/version.rb +1 -1
- data/lib/common_functions/view_helpers.rb +54 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa2248075ed33e04e7600c16bab0007be7eabffac0f84bbab33b5dd212f3f65d
|
4
|
+
data.tar.gz: c5107abbc03dc448b084d3c9c07cfcb88438a22768c3f2322b0fd39d2a9c0606
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 123c1eff736667f2d77ee66fb577c16ab4fe049e42ef4560d4b2015a2f08b7eb5ab7ae1a8fea69c63dd83fe4d9edae7bb1585cdee17bbbeb17d5169899268d98
|
7
|
+
data.tar.gz: 48da62b9ca500b64de8b41cb0ca60e88e45eca1739cc2b215ed11baf54712618d0a7dd49468875540e7d446490ebeb78979aca2e1e8669f9c5ebd20e300fef13
|
data/lib/common_functions.rb
CHANGED
@@ -1,39 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
class Button
|
6
|
-
def self.primary_btn
|
7
|
-
"btn btn-primary"
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.primary_btn_sm
|
11
|
-
"btn btn-primary btn-sm"
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.success_btn
|
15
|
-
"btn btn-success"
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.success_btn_sm
|
19
|
-
"btn btn-success btn-sm"
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.danger_btn
|
23
|
-
"btn btn-danger"
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.danger_btn_sm
|
27
|
-
"btn btn-danger btn-sm"
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
class DateTime
|
32
|
-
def self.print_date(timestamp)
|
33
|
-
timestamp.strftime("%F")
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.print_date_time(timestamp)
|
37
|
-
timestamp.strftime("%F %T")
|
38
|
-
end
|
39
|
-
end
|
1
|
+
require "common_functions/version"
|
2
|
+
require 'common_functions/view_helpers'
|
3
|
+
require "common_functions/railtie" if defined? Rails
|
@@ -1,13 +1,59 @@
|
|
1
1
|
module CommonFunctions
|
2
2
|
module ViewHelpers
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
3
|
+
def btn_primary
|
4
|
+
"btn btn-primary"
|
5
|
+
end
|
6
|
+
|
7
|
+
def btn_primary_sm
|
8
|
+
"btn btn-primary btn-sm"
|
9
|
+
end
|
10
|
+
|
11
|
+
def btn_success
|
12
|
+
"btn btn-success"
|
13
|
+
end
|
14
|
+
|
15
|
+
def btn_success_sm
|
16
|
+
"btn btn-success btn-sm"
|
17
|
+
end
|
18
|
+
|
19
|
+
def btn_danger
|
20
|
+
"btn btn-danger"
|
21
|
+
end
|
22
|
+
|
23
|
+
def btn_danger_sm
|
24
|
+
"btn btn-danger btn-sm"
|
25
|
+
end
|
26
|
+
|
27
|
+
def print_date(timestamp)
|
28
|
+
timestamp.strftime("%F")
|
29
|
+
end
|
30
|
+
|
31
|
+
def print_date_time(timestamp)
|
32
|
+
timestamp.strftime("%F %T")
|
33
|
+
end
|
34
|
+
|
35
|
+
def table_bordered
|
36
|
+
"<table class='table table-bordered'>".html_safe
|
37
|
+
end
|
38
|
+
|
39
|
+
def table_striped
|
40
|
+
"<table class='table table-striped'>".html_safe
|
41
|
+
end
|
42
|
+
|
43
|
+
def table_bordered_striped
|
44
|
+
"<table class='table table-bordered table-striped'>".html_safe
|
45
|
+
end
|
46
|
+
|
47
|
+
def table_head(name)
|
48
|
+
"<th>#{name}</th>".html_safe
|
49
|
+
end
|
50
|
+
|
51
|
+
def table_row_name_value(name, value)
|
52
|
+
"<tr><td>#{name}</td><td>#{value}</td></tr>".html_safe
|
53
|
+
end
|
54
|
+
|
55
|
+
def form_control
|
56
|
+
"form-control"
|
11
57
|
end
|
12
58
|
end
|
13
59
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: common_functions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ShaimaKaraki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Some common functions for Bootstrap tables and buttons.
|
14
14
|
email:
|