the-admin 0.0.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.
@@ -0,0 +1,179 @@
1
+ module TheAdmin
2
+ # Layout helpers
3
+ # @author Tim Mushen
4
+ module LayoutHelpers
5
+
6
+ # Card (top) view helper
7
+ # @param title [String] title of the card
8
+ # @param subtitle [String] subtitle of the card
9
+ # @param card_class [String] card html classes
10
+ # @param header_css [String] header css of the card
11
+ # @param buttons [String] card buttons
12
+ # @return [String] rendered card top html
13
+ def x_card_top(title: "",subtitle: "", card_class: "", header_css: "", buttons: "", modal_cog_url: "")
14
+
15
+ modal_cog_html = ""
16
+ unless modal_cog_url == ""
17
+ modal_cog_html = "<a href='#{modal_cog_url}' class='btn btn-button btn-sm' data-toggle='modal'><i class='fa fa-cog'></i></a>"
18
+ end
19
+ if title != ""
20
+ title =<<EOS
21
+ <div class="header #{header_css}">
22
+ <h4 class="title pull-left">#{title}</h4>
23
+ <div class="pull-right title_right">#{buttons} #{modal_cog_html}</div>
24
+ <div class="clearfix"></div>
25
+ <p class="category">#{subtitle}</p>
26
+ </div>
27
+ EOS
28
+ end
29
+ panel =<<EOS
30
+ <div class="card #{card_class}">
31
+ #{title}
32
+ <div class="content">
33
+ EOS
34
+ return panel
35
+ end
36
+
37
+ # Card (bottom) view helper
38
+ # @return [String] rendered card bottom html
39
+ def x_card_bottom
40
+ panel =<<EOS
41
+ </div>
42
+ </div>
43
+ EOS
44
+ return panel
45
+ end
46
+
47
+ # Accordian (top) view helper
48
+ def x_accordian_top(tag: "p", id: "accordian", title: "")
49
+
50
+ panel =<<EOS
51
+ <div class="panel-group" id="accordion">
52
+ <div class="panel panel-default">
53
+ <div class="panel-heading">
54
+ <#{tag} class="">
55
+ <a data-target="#accordian_#{id}" href="#" data-toggle="collapse">
56
+ #{title} <b class="caret"></b>
57
+ </a>
58
+ </#{tag}>
59
+ </div>
60
+ <div id="accordian_#{id}" class="panel-collapse collapse">
61
+ <div class="panel-body">
62
+ <!-- Start Accordian -->
63
+ EOS
64
+ return panel
65
+ end
66
+
67
+ # Accordian (bottom) view helper
68
+ # @return [String] accordian card bottom html
69
+ def x_accordian_bottom
70
+ panel =<<EOS
71
+ <!-- End Accordian -->
72
+ </div>
73
+ </div>
74
+ </div>
75
+ </div>
76
+ EOS
77
+ return panel
78
+ end
79
+
80
+ # Gravitar view helper
81
+ # @param email [String] email of the user to show the garvitar
82
+ # @return [String] gravitar image uri
83
+ def x_gravitar(email: "")
84
+ hash = ""
85
+
86
+ if !email.nil?
87
+ # get the email from URL-parameters or what have you and make lowercase
88
+ email_address = email.downcase
89
+
90
+ # create the md5 hash
91
+ hash = Digest::MD5.hexdigest(email_address)
92
+ end
93
+ # compile URL which can be used in <img src="RIGHT_HERE"...
94
+ image_src = "https://www.gravatar.com/avatar/#{hash}?d=mm"
95
+
96
+ return image_src
97
+ end
98
+
99
+ # Student Tabs Nav
100
+ # @param active [String] tab active
101
+ # @param tabs [Array] array of tabs
102
+ # @return [String] rendered tabs navigation
103
+ def x_tabs(active: "", tabs: array)
104
+
105
+ tab_builder = ""
106
+
107
+ tabs.each do |t|
108
+ s = ""
109
+ if t[:name] == active
110
+ active_s = "active"
111
+ else
112
+ active_s = ""
113
+ end
114
+
115
+ if t[:icon].present?
116
+ icon = "<i class='fa #{t[:icon]}'></i> "
117
+ else
118
+ icon = ""
119
+ end
120
+
121
+ s =<<EOS
122
+ <li class="#{active_s}">
123
+ <a href="#{t[:url]}">#{icon}#{t[:name]}</a>
124
+ </li>
125
+ EOS
126
+ tab_builder << s
127
+ end
128
+
129
+ tab_wrapper =<<EOS
130
+ <div class="tabs_wrapper">
131
+ <ul class="nav nav-tabs flex-wrap" role="tablist">
132
+ #{tab_builder}
133
+ </ul>
134
+ </div>
135
+ EOS
136
+
137
+ return tab_wrapper
138
+ end
139
+
140
+
141
+ # Dashboard Number Widget
142
+ # @param label [String] number widget label
143
+ # @param value [String] number widget value
144
+ # @param icon [String] number widget icon
145
+ # @return [String] rendered number widget
146
+ def x_number_widget(label: "", value: "", icon: "", info_modal: "", inversed: false)
147
+
148
+ icon_html = ""
149
+ unless icon == ""
150
+ icon_html = "<i class='fa #{icon}'></i> "
151
+ end
152
+
153
+ info_modal_html = ""
154
+ unless info_modal == ""
155
+ info_modal_html = "<a href='#{info_modal}' class='' data-toggle='modal'><i class='fa fa-info-circle'></i></a>"
156
+ end
157
+
158
+ if inversed == false
159
+ widget =<<EOS
160
+ <div class="x_number_widget_wrapper">
161
+ <div class="x_number_widget_value">#{value}</div>
162
+ <div class="x_number_widget_label">#{icon_html}#{label} #{info_modal_html}</div>
163
+ </div>
164
+ EOS
165
+ else
166
+ widget =<<EOS
167
+ <div class="x_number_widget_wrapper_inversed">
168
+ <div class="x_number_widget_label">#{icon_html}#{label} #{info_modal_html}</div>
169
+ <div class="x_number_widget_value">#{value}</div>
170
+ </div>
171
+ EOS
172
+
173
+ end
174
+
175
+ return widget
176
+
177
+ end
178
+ end
179
+ end
@@ -0,0 +1,3 @@
1
+ module TheAdmin
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ describe Platformx do
4
+
5
+ # Panel top
6
+ it "Panel top should have a title" do
7
+ expect(x_panel_top(title: "Testing Title")).to include("Testing Title")
8
+ end
9
+
10
+ # Panel Top
11
+ it "Panel shold return have a panel-body" do
12
+ expect(x_panel_top).to include("panel-body")
13
+ end
14
+
15
+ # Panel Bottom
16
+ it "Panel bottom should have ending div's" do
17
+ expect(x_panel_bottom).to include("</div>")
18
+ end
19
+ end
@@ -0,0 +1,16 @@
1
+ require "platformx" # and any other gems you need
2
+
3
+ RSpec.configure do |config|
4
+ # some (optional) config here
5
+ config.include Platformx::LayoutHelpers
6
+ config.include Platformx::DateHelpers
7
+ config.include Platformx::StripeHelpers
8
+ config.include Platformx::AuthHelpers
9
+ config.include Platformx::FormHelpers
10
+ config.include Platformx::LayoutHelpers
11
+ config.include Platformx::NotifyHelpers
12
+ config.include Platformx::GooglemapHelpers
13
+ config.include Platformx::InstagramHelpers
14
+ config.include Platformx::FakerHelpers
15
+ config.include Platformx::TextHelpers
16
+ end
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'the-admin/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "the-admin"
8
+ spec.version = TheAdmin::VERSION
9
+ spec.authors = ["timmushen"]
10
+ spec.email = ["tim.mushen@gmail.com"]
11
+ spec.summary = %q{The Admin Gem}
12
+ spec.description = %q{The Admin Gem for The Admin Theme. Not for public use.}
13
+ spec.homepage = "https://gitlab.com/timmushen/the-admin-gem"
14
+ spec.license = "Use by permission only."
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec"
24
+
25
+ # Add Gems
26
+ spec.add_dependency "digest", "~> 0"
27
+ spec.add_dependency "json"
28
+ end
metadata ADDED
@@ -0,0 +1,130 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: the-admin
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - timmushen
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-04-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: digest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: json
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: The Admin Gem for The Admin Theme. Not for public use.
84
+ email:
85
+ - tim.mushen@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".DS_Store"
91
+ - ".gitignore"
92
+ - ".rspec"
93
+ - Gemfile
94
+ - LICENSE.txt
95
+ - README.md
96
+ - Rakefile
97
+ - lib/the-admin.rb
98
+ - lib/the-admin/form.rb
99
+ - lib/the-admin/layout.rb
100
+ - lib/the-admin/version.rb
101
+ - spec/layout_spec.rb
102
+ - spec/spec_helper.rb
103
+ - the-admin.gemspec
104
+ homepage: https://gitlab.com/timmushen/the-admin-gem
105
+ licenses:
106
+ - Use by permission only.
107
+ metadata: {}
108
+ post_install_message:
109
+ rdoc_options: []
110
+ require_paths:
111
+ - lib
112
+ required_ruby_version: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ required_rubygems_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ requirements: []
123
+ rubyforge_project:
124
+ rubygems_version: 2.6.13
125
+ signing_key:
126
+ specification_version: 4
127
+ summary: The Admin Gem
128
+ test_files:
129
+ - spec/layout_spec.rb
130
+ - spec/spec_helper.rb