contour 0.3.2 → 0.4.0
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/CHANGELOG.rdoc +8 -0
- data/app/controllers/contour/registrations_controller.rb +18 -3
- data/app/views/contour/layouts/_menu.html.erb +2 -2
- data/app/views/contour/layouts/application.html.erb +3 -3
- data/app/views/contour/samples/index.html.erb +1 -1
- data/lib/contour.rb +7 -0
- data/lib/contour/version.rb +1 -1
- data/lib/generators/templates/contour.rb +8 -2
- data/test/functional/registrations_controller_test.rb +12 -3
- data/vendor/assets/images/contour/search.png +0 -0
- data/vendor/assets/stylesheets/contour/global.css +4 -0
- metadata +7 -6
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
== 0.4.0
|
2
|
+
|
3
|
+
* Enhancements
|
4
|
+
* Added new image assets
|
5
|
+
* :target allowed as a parameter for a link in the menu, ex: :target => '_blank'
|
6
|
+
* Added application_name_html configuration so that users can specify the html for the application name
|
7
|
+
* :image and :image_options can now be passed to links to specify an image that appears to the right of the link
|
8
|
+
|
1
9
|
== 0.3.2
|
2
10
|
|
3
11
|
* Bug Fix
|
@@ -1,9 +1,24 @@
|
|
1
1
|
class Contour::RegistrationsController < Devise::RegistrationsController
|
2
|
+
prepend_before_filter :require_no_authentication, :only => [ :new ]
|
3
|
+
|
2
4
|
def create
|
3
|
-
|
4
|
-
|
5
|
+
if user_signed_in?
|
6
|
+
params[:user][:password] = params[:user][:password_confirmation] = Digest::SHA1.hexdigest(Time.now.usec.to_s)[0..19]
|
7
|
+
@user = User.new(params[:user])
|
8
|
+
if @user.save
|
9
|
+
[:pp_committee, :pp_committee_secretary, :steering_committee, :steering_committee_secretary, :system_admin, :status].each do |attribute|
|
10
|
+
@user.update_attribute attribute, params[:user][attribute]
|
11
|
+
end
|
12
|
+
redirect_to(@user, :notice => 'User was successfully created.')
|
13
|
+
else
|
14
|
+
render :action => "/users/new"
|
15
|
+
end
|
16
|
+
else
|
17
|
+
super
|
18
|
+
session[:omniauth] = nil unless @user.new_record?
|
19
|
+
end
|
5
20
|
end
|
6
|
-
|
21
|
+
|
7
22
|
private
|
8
23
|
|
9
24
|
def build_resource(*args)
|
@@ -6,14 +6,14 @@
|
|
6
6
|
<% Contour.menu_items.each do |menu_item| %>
|
7
7
|
<% if display.include?(menu_item[:display]) and (menu_item[:condition].blank? or eval(menu_item[:condition])) %>
|
8
8
|
<div style="float:<%= menu_item[:position] %>">
|
9
|
-
<%= link_to_function (menu_item[:eval] ? eval(menu_item[:name]) : menu_item[:name]), "$('#menu_#{menu_item[:id]}').show();", :onmouseover => "$('#menu_#{menu_item[:id]}').show();" %>
|
9
|
+
<%= link_to_function (menu_item[:eval] ? eval(menu_item[:name]) : menu_item[:name].html_safe + (menu_item[:image].blank? ? '' : image_tag(menu_item[:image], menu_item[:image_options]))), "$('#menu_#{menu_item[:id]}').show();", :onmouseover => "$('#menu_#{menu_item[:id]}').show();" %>
|
10
10
|
<div style="position:relative;">
|
11
11
|
<div id="menu_<%= menu_item[:id] %>" class="menu_dropdown_<%= menu_item[:position_class] %>" style="display:none">
|
12
12
|
<% menu_item[:links].each do |link| %>
|
13
13
|
<% if link[:condition].blank? or eval(link[:condition]) %>
|
14
14
|
<% if link[:html].blank? %>
|
15
15
|
<div style="white-space:nowrap">
|
16
|
-
<%= link_to (link[:eval] ? eval(link[:name]) : link[:name].html_safe), eval(link[:path]), :class => 'noicon' %>
|
16
|
+
<%= link_to (link[:eval] ? eval(link[:name]) : link[:name].html_safe + (link[:image].blank? ? '' : image_tag(link[:image], link[:image_options]))), eval(link[:path]), :class => 'noicon', :target => link[:target] %>
|
17
17
|
</div>
|
18
18
|
<% else %>
|
19
19
|
<%= link[:eval] ? eval(link[:html]).html_safe : link[:html].html_safe %>
|
@@ -8,13 +8,13 @@
|
|
8
8
|
<%= csrf_meta_tags %>
|
9
9
|
</head>
|
10
10
|
<body>
|
11
|
-
<%= javascript_tag "var root_url='#{
|
12
|
-
<div id="header" class="container" style="background-image: url(<%=
|
11
|
+
<%= javascript_tag "var root_url='#{Contour.application_site_url + '/'}';var auth_token='#{form_authenticity_token}';" %>
|
12
|
+
<div id="header" class="container" style="background-image: url(<%= Contour.application_site_url %>/assets/<%= Contour.header_background_image %>);">
|
13
13
|
<div id="version" style="position:relative;display:none">
|
14
14
|
<span style="position:absolute;top:-15px;left:82px;font-size:0.5em;font-variant:normal" class="quiet"><%= Contour.application_version %></span>
|
15
15
|
</div>
|
16
16
|
<%= image_tag(Contour.header_title_image, :alt => '', :style => 'vertical-align:middle') unless Contour.header_title_image.blank? %>
|
17
|
-
<%= link_to
|
17
|
+
<%= link_to (Contour.application_name_html.blank? ? Contour.application_name : Contour.application_name_html.html_safe), root_path, :style => 'text-decoration:none;color:#404040;', :onmouseover => "$('#version').show();", :onmouseout => "$('#version').hide();" %>
|
18
18
|
</div>
|
19
19
|
|
20
20
|
<div class="container" style="position:relative">
|
@@ -15,7 +15,7 @@ If the file does not exist run:<br />
|
|
15
15
|
<br />
|
16
16
|
<code style="margin-left:10px">rails generate contour:install</code><br />
|
17
17
|
<br />
|
18
|
-
<%
|
18
|
+
<% (Contour.class_variables.collect{|v| v.to_s.gsub('@@','')} - ['menu_items']).each do |attribute| %>
|
19
19
|
<p>
|
20
20
|
<b><%= attribute.titleize %>:</b>
|
21
21
|
<% if Contour.send(attribute).blank? %>
|
data/lib/contour.rb
CHANGED
@@ -5,11 +5,18 @@ module Contour
|
|
5
5
|
# Default Application Name
|
6
6
|
mattr_accessor :application_name
|
7
7
|
@@application_name = nil
|
8
|
+
|
9
|
+
mattr_accessor :application_name_html
|
10
|
+
@@application_name_html = nil
|
8
11
|
|
9
12
|
# Default Application Version
|
10
13
|
mattr_accessor :application_version
|
11
14
|
@@application_version = nil
|
12
15
|
|
16
|
+
# Default Application Site URL
|
17
|
+
mattr_accessor :application_site_url
|
18
|
+
@@application_site_url = 'http://localhost'
|
19
|
+
|
13
20
|
# Default Application Version
|
14
21
|
mattr_accessor :header_background_image
|
15
22
|
@@header_background_image = 'rails.png'
|
data/lib/contour/version.rb
CHANGED
@@ -3,10 +3,16 @@ Contour.setup do |config|
|
|
3
3
|
|
4
4
|
# Enter your application name here. The name will be displayed in the title of all pages, ex: AppName - PageTitle
|
5
5
|
# config.application_name = ''
|
6
|
+
|
7
|
+
# If you want to style your name using html you can do so here, ex: <b>App</b>Name
|
8
|
+
# config.application_name_html = ''
|
6
9
|
|
7
10
|
# Enter your application version here. Do not include a trailing backslash. Recommend using a predefined constant
|
8
11
|
# config.application_version = ''
|
9
12
|
|
13
|
+
# Enter the url of your site without a trailing slash, ex: http://localhost/app_root
|
14
|
+
# config.application_site_url = 'http://localhost'
|
15
|
+
|
10
16
|
# Enter your application header background image here.
|
11
17
|
# config.header_background_image = 'rails.png'
|
12
18
|
|
@@ -23,8 +29,8 @@ Contour.setup do |config|
|
|
23
29
|
# :links => [{:html => '"<div style=\"white-space:nowrap\">"+current_user.name+"</div>"', :eval => true}, {:html => '"<div class=\"small quiet\">"+current_user.email+"</div>"', :eval => true}, {:name => 'Authentications', :path => 'authentications_path'}, {:html => "<hr>"}, {:name => 'Logout', :path => 'destroy_user_session_path'}]
|
24
30
|
# },
|
25
31
|
# {
|
26
|
-
# :name => 'Home', :id => 'home', :display => 'always', :position => 'left', :position_class => 'left', :condition => 'true',
|
27
|
-
# :links => [{:name => 'Home', :path => 'root_path'}, {:html => "<hr>"}, {:name => 'About', :path => 'about_path'}]
|
32
|
+
# :name => 'Home', :id => 'home', :display => 'always', :position => 'left', :position_class => 'left', :condition => 'true', :image => '', :image_options => {},
|
33
|
+
# :links => [{:name => 'Home', :path => 'root_path', :image => '', :image_options => {}}, {:html => "<hr>"}, {:name => 'About', :path => 'about_path'}]
|
28
34
|
# }]
|
29
35
|
|
30
36
|
end
|
@@ -1,8 +1,17 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class RegistrationsControllerTest < ActionController::TestCase
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
setup do
|
5
|
+
login(users(:admin))
|
6
|
+
request.env["devise.mapping"] = Devise.mappings[:user]
|
7
|
+
end
|
8
|
+
|
9
|
+
test "an admin should be able to create new user" do
|
10
|
+
assert_difference('User.count') do
|
11
|
+
post :create, :user => {:first_name => 'First Name', :last_name => 'Last Name', :status => 'active', :email => 'new_registration@example.com',
|
12
|
+
:steering_committee => true, :steering_committee_secretary => false, :pp_committee => false, :pp_committee_secretary => false, :system_admin => false}
|
13
|
+
end
|
14
|
+
|
15
|
+
assert_redirected_to user_path(assigns(:user))
|
7
16
|
end
|
8
17
|
end
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contour
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-09-
|
12
|
+
date: 2011-09-07 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: devise
|
16
|
-
requirement: &
|
16
|
+
requirement: &70221595619420 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.4.4
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70221595619420
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: omniauth
|
27
|
-
requirement: &
|
27
|
+
requirement: &70221595618520 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: 0.2.6
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70221595618520
|
36
36
|
description: Basic Rails Framework files and assets for layout and authentication
|
37
37
|
email: remosm@gmail.com
|
38
38
|
executables: []
|
@@ -106,6 +106,7 @@ files:
|
|
106
106
|
- vendor/assets/images/contour/openid_64.png
|
107
107
|
- vendor/assets/images/contour/pdf.png
|
108
108
|
- vendor/assets/images/contour/save.png
|
109
|
+
- vendor/assets/images/contour/search.png
|
109
110
|
- vendor/assets/images/contour/tag_blue.png
|
110
111
|
- vendor/assets/images/contour/tag_green.png
|
111
112
|
- vendor/assets/images/contour/tag_neutral.png
|