instedd-rails 0.0.10 → 0.0.11

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.
data/README.markdown ADDED
@@ -0,0 +1,73 @@
1
+ InSTEDD Platform Common Rails
2
+ =============================
3
+
4
+ This gem makes it easy to apply the look and feel found in InSTEDD applications.
5
+
6
+ Installation
7
+ ------------
8
+
9
+ gem install instedd-rails
10
+
11
+ Gemfile
12
+ -------
13
+
14
+ gem 'instedd-rails'
15
+
16
+ Usage
17
+ -----
18
+
19
+ Your application layout in app/views/layouts/application.html.erb should
20
+ look something like this:
21
+
22
+ <% content_for :navigation do %>
23
+ <%= section "Home", root_path, :home %>
24
+ <%= section "Tour", tour_path, :tour %>
25
+ <%= section "Community", community_path, :community %>
26
+ <%= section "Help", help_path, :help %>
27
+ <% end %>
28
+ <% content_for :right_menu do %>
29
+ <ul class="RightMenu">
30
+ <%- if user_signed_in? %>
31
+ <li>
32
+ <div id="User">
33
+ <%=current_user.email%><br><br>
34
+ <div class="container">
35
+ <ul>
36
+ <li><%= link_to 'Settings', edit_user_registration_path %></li>
37
+ </ul>
38
+ <hr/>
39
+ <ul>
40
+ <li><a href="mailto:support@instedd.org?subject=[<%= application_name.underscore %>-bug]">Report a bug</a></li>
41
+ <li><%= link_to "Sign Out", destroy_user_session_path, :method => :delete %></li>
42
+ </ul>
43
+ </div>
44
+ </div>
45
+ </li>
46
+ <li>
47
+ <%= link_to '', edit_user_registration_path, :class => 'fsettings' %>
48
+ </li>
49
+ <% else %>
50
+ <li>
51
+ <%= link_to "Create account", new_user_registration_path, :class => 'fedit' %>
52
+ </li>
53
+ <li>
54
+ <%= link_to "Log in", new_user_session_path, :class => 'fuser' %>
55
+ </li>
56
+ <% end %>
57
+ </ul>
58
+ <% end %>
59
+ <% content_for :footer_links do %>
60
+ <a href="<%= root_path %>">Home</a>
61
+ <% end %>
62
+ <%= render :file => 'layouts/instedd_application' %>
63
+
64
+ To specify the breadcrumbs, in your controller:
65
+
66
+ class YourController < ApplicationController
67
+ def index
68
+ @show_breadcrumb = true
69
+ add_breadcrumb 'Home', home_path
70
+ end
71
+ end
72
+
73
+ Read more about the [breadcrumbs\_on\_rails gem](https://github.com/weppos/breadcrumbs_on_rails).
@@ -3,7 +3,7 @@ module InsteddRails
3
3
  def link_button_to(body, url, html_options = {})
4
4
  default_options = { :type => 'button', :class => 'white' }
5
5
  onclick = "window.location='#{url}';return false;"
6
-
6
+
7
7
  content_tag(:button, body, default_options.merge(html_options.merge(:onclick => onclick)))
8
8
  end
9
9
 
@@ -11,22 +11,31 @@ module InsteddRails
11
11
  active = active_controllers.any?{|controller| controller_name == controller.to_s }
12
12
  raw "<li class=\"#{active ? "active" : ""}\">#{link_to title, url}</li>"
13
13
  end
14
-
14
+
15
15
  def breadcrumb
16
16
  raw render_breadcrumbs :builder => BreadcrumbBuilder
17
17
  end
18
-
18
+
19
+ def tab(label, path = nil)
20
+ s = "<li"
21
+ s << ' class="active"' if path && current_page?(path)
22
+ s << ">"
23
+ s << (link_to label, path)
24
+ s << "</li>"
25
+ raw s
26
+ end
27
+
19
28
  def sortable(column, title = nil)
20
29
  title ||= column.titleize
21
30
  page_number = params[:page]
22
31
  direction = column == sort_column && sort_direction == "asc" ? "desc" : "asc"
23
32
  (link_to title, :sort => column, :direction => direction, :page => params[:page]) + '<span></span>'.html_safe
24
33
  end
25
-
34
+
26
35
  def css_sort_class_for column
27
36
  column == sort_column ? "sort #{css_sort_direction}" : "sort"
28
37
  end
29
-
38
+
30
39
  def css_sort_direction
31
40
  sort_direction == "asc" ? "up" : "down"
32
41
  end
@@ -42,6 +51,5 @@ module InsteddRails
42
51
  def version_name
43
52
  InsteddRails.config.version_name
44
53
  end
45
-
46
54
  end
47
- end
55
+ end
@@ -2,9 +2,9 @@ module InsteddRails
2
2
  module InsteddAppHelper
3
3
  def flash_message
4
4
  res = nil
5
-
5
+
6
6
  keys = { :notice => 'flash_notice', :error => 'flash_error', :alert => 'flash_error' }
7
-
7
+
8
8
  keys.each do |key, value|
9
9
  if flash[key]
10
10
  html_option = { :class => "flash #{value}" }
@@ -16,16 +16,16 @@ module InsteddRails
16
16
  end
17
17
  end
18
18
  end
19
-
19
+
20
20
  res
21
21
  end
22
-
22
+
23
23
  def errors_for(object, options = {})
24
24
  unless object.nil?
25
25
  if object.errors.any?
26
26
  # TODO change on rails 3.1 to ActiveModel::Naming.param_key(object)
27
27
  object_name = options[:as].try(:to_s) || ActiveModel::Naming.singular(object)
28
-
28
+
29
29
  content_tag :div, :class => "box error_description #{options[:class] || 'w60'}" do
30
30
  (content_tag :h2 do
31
31
  "#{pluralize(object.errors.count, 'error')} prohibited this #{object_name.humanize} from being saved:"
@@ -39,4 +39,4 @@ module InsteddRails
39
39
  end
40
40
  end
41
41
  end
42
- end
42
+ end
@@ -1,3 +1,3 @@
1
1
  module InsteddRails
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: instedd-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-01-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70207905771840 !ruby/object:Gem::Requirement
16
+ requirement: &70278110002240 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '3.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70207905771840
24
+ version_requirements: *70278110002240
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: breadcrumbs_on_rails
27
- requirement: &70207905793020 !ruby/object:Gem::Requirement
27
+ requirement: &70278110023520 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70207905793020
35
+ version_requirements: *70278110023520
36
36
  description: This gem unifies all the helpers and common views used by all Instedd
37
37
  applications
38
38
  email:
@@ -44,6 +44,7 @@ files:
44
44
  - .gitignore
45
45
  - .rvmrc
46
46
  - Gemfile
47
+ - README.markdown
47
48
  - Rakefile
48
49
  - app/controllers/errors_controller.rb
49
50
  - app/controllers/instedd_rails/tour_controller.rb