biola_frontend_toolkit 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 30593500423411391197274af31cfa7cfbc06755
4
+ data.tar.gz: 6509ebff93768b6e932a04b7959d0f86368ca59e
5
+ SHA512:
6
+ metadata.gz: 580f710aa81371a9590f16fe2f8aaf8b2bd5317e24f0a1bcf17f20cf5d36ff1334cb242bc1c3d3723372fd017f5b1dcc110a25b7482cec2820fae4a4744935e3
7
+ data.tar.gz: 7594194ad238d6271483f5d83bec035550874a0e53c45be5ae8c207e6b425274a392be454ccb36729be3caa91a6eff84b08dd010e09cfd82c691bb328e5975bb
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ .rspec
4
+ Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in biola_frontend_toolkit.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Ryan Hall
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,74 @@
1
+ # Biola Frontend Toolkit
2
+
3
+ This toolkit includes a shared header and some other view helpers designed for our Biola web applications.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'biola_frontend_toolkit'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install biola_frontend_toolkit
18
+
19
+ #### Dependencies
20
+
21
+ * bootstrap-sass
22
+ * font-awesome-rails
23
+
24
+ ## Usage
25
+
26
+ ### Rails > 3.1
27
+
28
+ Your layout file should look something like this
29
+
30
+ doctype html
31
+ html lang="en-us"
32
+ head
33
+ / frontend_toolkit/head includes default html head tags and csrf_meta_tags
34
+ = render 'frontend_toolkit/head', title: 'Direcotry'
35
+ = stylesheet_link_tag "application", media: "all"
36
+ body class="#{controller_name} #{action_name}"
37
+ = render 'frontend_toolkit/header'
38
+ = yield
39
+ = javascript_include_tag "application"
40
+
41
+ Include the following in `application.css.scss`. This will add require statements for `bootstrap` and `font-awesome` automatically.
42
+
43
+ //= require biola-frontend-toolkit
44
+
45
+ Include the following in `application.js.coffee`. This includes `jquery`, `jquery_ujs`, and `bootstrap` automatically.
46
+
47
+ #= require biola-frontend-toolkit
48
+
49
+
50
+ #### Other requirements
51
+
52
+ * `@current_user` - When a user is logged in
53
+ * `logout_path` - Should return a link to the logout path
54
+ * `/whateverpath?login=true` - Should be caught by ApplicationController and redirect to login page if not already logged in.
55
+
56
+
57
+ #### Configuration
58
+
59
+ Create a new file called `/config/initializers/biola_frontend_toolkit.rb`
60
+
61
+ BiolaFrontendToolkit.configure do |config|
62
+ config.app_name = Settings.app.name
63
+ config.app_version = Version.current # optional
64
+ config.relative_root = Settings.app.relative_url_root
65
+ end
66
+
67
+
68
+ ## Contributing
69
+
70
+ 1. Fork it
71
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
72
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
73
+ 4. Push to the branch (`git push origin my-new-feature`)
74
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,4 @@
1
+ #= require jquery
2
+ #= require jquery_ujs
3
+ #= require bootstrap
4
+ #= require_self
@@ -0,0 +1,102 @@
1
+ body { margin: 0; }
2
+ #wrapperBiolaHeader { background:#111; width:100%; }
3
+ #biolaHeader { margin:0 auto; padding:0 15px; height: 42px;
4
+ a { text-decoration:none; color:#FFF; }
5
+
6
+ .branding { float:left; font-weight:bold; font-size:13px; height:42px; line-height:42px; margin:0; font-family:'proxima-nova', 'avenir next',Helvetica,Arial,sans-serif; text-transform:uppercase; letter-spacing:0.25em;
7
+ img { width:22px; height:22px; vertical-align:top; display:inline-block; margin:0.75em 0.5em 0 0; }
8
+ .university { display: none; }
9
+ }
10
+
11
+
12
+ // Customize header dropdown menus. These will still use Bootstrap but will overwrite some of it's default styles.
13
+ .dropdown { float: right;
14
+ .dropdown-toggle { display: block; text-align:center; line-height:42px; padding:0 15px; color:#CCC; cursor:pointer; background:transparent; border:0; outline:0; -webkit-user-select: none; -webkit-appearance:none;
15
+ i.fa { vertical-align: middle; }
16
+ }
17
+ .dropdown-menu { top: 122%; border-radius: 0; min-width: 230px;
18
+ > li {
19
+ > a { color:inherit; padding: 10px 20px;
20
+ i { margin-right: 8px; }
21
+ }
22
+ }
23
+
24
+ // Add the little carret to the dropdown.
25
+ &::before { position: absolute; top: -15px; right: 9px; display: inline-block; border-right: 10px solid transparent; border-bottom: 15px solid #CCC; border-left: 10px solid transparent; border-bottom-color: rgba(0, 0, 0, 0.2); content: ''; }
26
+ &::after { position: absolute; top: -14px; right: 10px; display: inline-block; border-right: 9px solid transparent; border-bottom: 14px solid white; border-left: 9px solid transparent; content: ''; }
27
+ }
28
+
29
+ &.open {
30
+ .dropdown-toggle { background: white; color: #333; }
31
+ }
32
+
33
+ &#global-alerts { font-size:14px;
34
+ .dropdown-menu { padding: 0;
35
+ > li { border-bottom: 1px solid #ddd; position: relative;
36
+ &:last-child { border: none; }
37
+ > a { white-space: initial; }
38
+ }
39
+ }
40
+ }
41
+
42
+ &#apps-list { font-size:12px;
43
+ .dropdown-toggle {
44
+ .desktop { display:none; }
45
+ .mobile .app-list-icon { font-size: 18px; padding-right: 10px; }
46
+ .mobile .fa-home { font-size: 18px; }
47
+ }
48
+ }
49
+
50
+ &#current-user-profile {
51
+ #profile-img { height: 30px; width: 30px; background-position: center; background-repeat: no-repeat; background-size: cover; border-radius: 20px; display: inline-block; vertical-align: middle; }
52
+ .dropdown-menu {
53
+ // Adjust where the little carret points so that it is right under the profile picture
54
+ &::before { right: 19px; }
55
+ &::after { right: 20px; }
56
+ }
57
+ }
58
+ }
59
+ }
60
+
61
+
62
+ @media screen and (max-width:360px) {
63
+ #biolaHeader {
64
+ #apps-list.dropdown {
65
+ .dropdown-menu { right: -80px;
66
+ &::before { right: 87px; }
67
+ &::after { right: 88px; }
68
+ }
69
+ }
70
+ }
71
+ }
72
+
73
+ @media screen and (min-width:549px) {
74
+ #biolaHeader {
75
+ #apps-list.dropdown {
76
+ .dropdown-toggle {
77
+ .mobile { display:none; }
78
+ .desktop { display: block; }
79
+ .desktop .version { padding-left: 5px; font-size: 10px; }
80
+ .desktop .label { margin-left: 8px; margin-right: 5px; }
81
+ }
82
+ }
83
+ }
84
+ }
85
+
86
+ @media screen and (min-width:768px) {
87
+ #biolaHeader {
88
+ .branding .university { display: inline; }
89
+ }
90
+ }
91
+
92
+ @media screen and (min-width:768px) {
93
+ #biolaHeader { width:750px; }
94
+ }
95
+
96
+ @media screen and (min-width:992px) {
97
+ #biolaHeader { width:970px; }
98
+ }
99
+
100
+ @media screen and (min-width:1200px) {
101
+ #biolaHeader { width:1170px; }
102
+ }
@@ -0,0 +1,4 @@
1
+ #alphaBanner { padding: 10px; width: 100%; color: #0b0c0c; background-color: #d53880; }
2
+ #alphaBanner a { color: #0b0c0c; text-decoration: underline; }
3
+ #betaBanner { padding: 10px; width: 100%; color: #0b0c0c; background-color: #D58338; }
4
+ #betaBanner a { color: #0b0c0c; text-decoration: underline; }
@@ -0,0 +1,4 @@
1
+ //= require bootstrap
2
+ //= require font-awesome
3
+ //= require_tree ./biola
4
+ //= require_self
@@ -0,0 +1,40 @@
1
+ module BiolaFrontend
2
+ module Rails
3
+ module FrontendToolkitHelper
4
+
5
+ def show_environment
6
+ unless ::Rails.env.match(/prod/i)
7
+ content_tag :span, ::Rails.env, class: 'label label-danger'
8
+ end
9
+ end
10
+
11
+ def yield_or(name, or_content=nil, &block)
12
+ if content_for?(name)
13
+ content_for(name)
14
+ elsif or_content
15
+ or_content
16
+ elsif block_given?
17
+ yield(block)
18
+ else
19
+ ''
20
+ end
21
+ end
22
+
23
+ def app_dropdown_link(dropdown, &block)
24
+ link_options = {'class'=>'dropdown-toggle'}
25
+ link_options = {'class'=>'dropdown-toggle', 'area-hidden'=>'true', 'data-toggle'=>'dropdown'} if dropdown
26
+ link_to (dropdown ? '#' : BiolaFrontendToolkit.config.relative_root), link_options do
27
+ yield if block_given?
28
+ end
29
+ end
30
+
31
+ def app_link(app)
32
+ icon_string = app[:icon].present? ? "#{fa_icon(app[:icon])} " : ''
33
+ link_to app[:url] do
34
+ (icon_string + app[:title]).html_safe
35
+ end
36
+ end
37
+
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,11 @@
1
+ - feedback_form_url ||= nil
2
+ #wrapperPreRelease
3
+ #alphaBanner.pre-release-banner
4
+ .container
5
+ span
6
+ strong ALPHA:
7
+ '
8
+ - if feedback_form_url
9
+ | This is a prototype — your #{link_to 'feedback', feedback_form_url, target: '_blank' } will help us improve it.
10
+ - else
11
+ | This is a prototype.
@@ -0,0 +1,7 @@
1
+ #wrapperPreRelease
2
+ #betaBanner.pre-release-banner
3
+ .container
4
+ span
5
+ strong BETA:
6
+ '
7
+ | This is a trial service — your #{link_to 'feedback', 'https://forms.biola.edu/information-technology/profile-publisher-feedback'} will help us improve it.
@@ -0,0 +1,8 @@
1
+ meta charset="utf-8"
2
+ meta http-equiv="X-UA-Compatible" content="IE=edge"
3
+ meta name="viewport" content="width=device-width, initial-scale=1"
4
+ link rel="icon" type="image/png" href="https://media1.biola.edu/biola/img/biola-icon.png"
5
+
6
+ title = yield_or :title, (title || BiolaFrontendToolkit.config.app_name)
7
+
8
+ = csrf_meta_tags
@@ -0,0 +1,62 @@
1
+ #header
2
+ #wrapperBiolaHeader
3
+ #biolaHeader
4
+ h2.branding
5
+ a.logo href="http://www.biola.edu"
6
+ img> src="http://academics.biola.edu/static/biola/header-slim/images/logo-biola-mark-white.png" alt=""
7
+ ' Biola
8
+ span.university University
9
+
10
+ #current-user-profile.dropdown
11
+ a.dropdown-toggle href="#" aria-hidden="true" data-toggle="dropdown"
12
+ - if @current_user
13
+ #profile-img style="background-image: url('#{@current_user.photo_url}')"
14
+ - else
15
+ i.fa.fa-user
16
+ ul.dropdown-menu.pull-right role="menu" aria-labelledby="dLabel"
17
+ - if @current_user
18
+ li
19
+ = link_to '#' do
20
+ i.fa.fa-user>
21
+ | My Account
22
+ li
23
+ = link_to logout_path do
24
+ i.fa.fa-power-off>
25
+ | Logout
26
+ - else
27
+ li = link_to 'Login', params.merge(login: 'true')
28
+
29
+ / - if @current_user
30
+ / #global-alerts.dropdown
31
+ / a.dropdown-toggle href="#" aria-hidden="true" data-toggle="dropdown"
32
+ / i.fa.fa-bell-o
33
+ / ul.dropdown-menu.pull-right role="menu" aria-labelledby="dLabel"
34
+ / li = link_to 'This is a really important message...', '#'
35
+ / li = link_to 'Your last timecard is way overdue.', '#'
36
+ / li = link_to 'You are in quite the pickle mister.', '#'
37
+ / li = link_to 'Your student bill was due last week Thursday.', '#'
38
+ / li = link_to 'You owe us one million dollars, plus a delicious candy bar.', '#'
39
+
40
+ #apps-list.dropdown
41
+ = app_dropdown_link BiolaFrontendToolkit.config.app_links.present? do
42
+ span.desktop
43
+ = BiolaFrontendToolkit.config.app_name
44
+ - if BiolaFrontendToolkit.config.app_version.present?
45
+ span.version = "v#{BiolaFrontendToolkit.config.app_version}"
46
+ = show_environment
47
+ - if BiolaFrontendToolkit.config.app_links.present?
48
+ i.fa.fa-caret-down<
49
+ span.mobile
50
+ - if BiolaFrontendToolkit.config.app_links.present?
51
+ i.fa.fa-list.app-list-icon
52
+ i.fa.fa-caret-down
53
+ - else
54
+ i.fa.fa-home
55
+
56
+ - if BiolaFrontendToolkit.config.app_links.present?
57
+ ul.dropdown-menu.pull-right role="menu" aria-labelledby="dLabel"
58
+ - BiolaFrontendToolkit.config.app_links.each do |app|
59
+ li = app_link app
60
+ / li.divider
61
+ / li.text-center = link_to 'More', '#'
62
+
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'biola_frontend_toolkit/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "biola_frontend_toolkit"
8
+ spec.version = BiolaFrontendToolkit::VERSION
9
+ spec.authors = ["Ryan Hall"]
10
+ spec.email = ["ryan.hall@biola.edu"]
11
+ spec.description = %q{this is a description}
12
+ spec.summary = %q{this is a summary}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
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.3"
22
+ spec.add_development_dependency "rake"
23
+ end
@@ -0,0 +1,15 @@
1
+ module BiolaFrontendToolkit
2
+ class Configuration
3
+ attr_accessor :app_name
4
+ attr_accessor :app_version
5
+ attr_accessor :relative_root
6
+ attr_accessor :app_links
7
+
8
+ def initialize
9
+ @app_name = 'App Name'
10
+ @app_version = ''
11
+ @relative_root = '/'
12
+ @app_links = []
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,6 @@
1
+ module BiolaFrontendToolkit
2
+ module Rails
3
+ class Engine < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,3 @@
1
+ module BiolaFrontendToolkit
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,14 @@
1
+ require "biola_frontend_toolkit/version"
2
+ require "biola_frontend_toolkit/engine" if defined?(::Rails)
3
+
4
+ module BiolaFrontendToolkit
5
+ require 'biola_frontend_toolkit/configuration'
6
+
7
+ def self.configure
8
+ yield config
9
+ end
10
+
11
+ def self.config
12
+ @config ||= Configuration.new
13
+ end
14
+ end
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: biola_frontend_toolkit
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Ryan Hall
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-06-21 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.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
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
+ description: this is a description
42
+ email:
43
+ - ryan.hall@biola.edu
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - app/assets/javascripts/biola-frontend-toolkit.js.coffee
54
+ - app/assets/stylesheets/biola-frontend-toolkit.css.scss
55
+ - app/assets/stylesheets/biola/header.css.scss
56
+ - app/assets/stylesheets/biola/prerelease.css.scss
57
+ - app/helpers/biola_frontend/rails/frontend_toolkit_helper.rb
58
+ - app/views/frontend_toolkit/_alpha_banner.html.slim
59
+ - app/views/frontend_toolkit/_beta_banner.html.slim
60
+ - app/views/frontend_toolkit/_head.html.slim
61
+ - app/views/frontend_toolkit/_header.html.slim
62
+ - biola_frontend_toolkit.gemspec
63
+ - lib/biola_frontend_toolkit.rb
64
+ - lib/biola_frontend_toolkit/configuration.rb
65
+ - lib/biola_frontend_toolkit/engine.rb
66
+ - lib/biola_frontend_toolkit/version.rb
67
+ homepage: ''
68
+ licenses:
69
+ - MIT
70
+ metadata: {}
71
+ post_install_message:
72
+ rdoc_options: []
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ requirements: []
86
+ rubyforge_project:
87
+ rubygems_version: 2.2.2
88
+ signing_key:
89
+ specification_version: 4
90
+ summary: this is a summary
91
+ test_files: []