Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
241 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
class UsersController < ApplicationController | ||
before_filter :login_required, :only => [ :show, :edit, :update ] | ||
|
||
def new | ||
@user = User.new | ||
end | ||
|
||
def create | ||
@user = User.new(params[:user]) | ||
if @user.save | ||
flash[:notice] = 'Account created!' | ||
continue_or_redirect_to root_path | ||
else | ||
render :action => :new | ||
end | ||
end | ||
|
||
def show | ||
@user = current_user | ||
end | ||
|
||
def edit | ||
@user = current_user | ||
end | ||
|
||
def update | ||
@user = current_user | ||
if @user.update_attributes(params[:user]) | ||
flash[:notice] = 'Account updated!' | ||
redirect_to root_path | ||
else | ||
render :action => :edit | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module UsersHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<%= f.error_messages %> | ||
|
||
<div class="group"> | ||
<%= f.label :login, 'Login', :class => 'label' %> | ||
<%= f.text_field :login, :class => 'text_field' %> | ||
<span class="description">* Required</span> | ||
</div> | ||
|
||
<div class="group"> | ||
<%= f.label :email, 'Email', :class => 'label' %> | ||
<%= f.text_field :email, :class => 'text_field' %> | ||
<span class="description">Any valid email address.</span> | ||
</div> | ||
|
||
<div class="group"> | ||
<%= f.label :password, 'Password', :class => 'label' %> | ||
<%= f.password_field :password, :class => 'text_field' %> | ||
<span class="description">* Required</span> | ||
</div> | ||
|
||
<div class="group"> | ||
<%= f.label :password_confirmation, 'Password Confirmation', :class => 'label' %> | ||
<%= f.password_field :password_confirmation, :class => 'text_field' %> | ||
<span class="description">One more time.</span> | ||
</div> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<% content_for :sidebar, render(:partial => 'sidebar') -%> | ||
|
||
<div class="block"> | ||
<div class="secondary-navigation"> | ||
<ul class="wat-cf"> | ||
<li class="first"><%= link_to "#{t("web-app-theme.list", :default => "List")}", users_path %></li> | ||
<li><%= link_to "#{t("web-app-theme.new", :default => "New")}", new_user_path %></li> | ||
<li class="active"><%= link_to "#{t("web-app-theme.edit", :default => "Edit")}", edit_user_path %></li> | ||
</ul> | ||
</div> | ||
<div class="content"> | ||
<h2 class="title"><%= t("web-app-theme.edit", :default => "Edit") %> User</h2> | ||
<div class="inner"> | ||
<% form_for @user, :url => user_path(@user), :html => { :class => :form } do |f| -%> | ||
<%= render :partial => "form", :locals => {:f => f} %> | ||
<div class="group navform wat-cf"> | ||
<button class="button" type="submit"> | ||
<%= image_tag("web-app-theme/tick.png", :alt => "#{t("web-app-theme.save", :default => "Save")}") %> <%= t("web-app-theme.save", :default => "Save") %> | ||
</button> | ||
<%= link_to "#{image_tag("web-app-theme/cross.png", :alt => "#{t("web-app-theme.cancel", :default => "Cancel")}")} #{t("web-app-theme.cancel", :default => "Cancel")}", users_path, :class => "button" %> | ||
</div> | ||
<% end -%> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<% content_for :sidebar, render(:partial => 'sidebar') -%> | ||
|
||
<div class="block"> | ||
<div class="secondary-navigation"> | ||
<ul class="wat-cf"> | ||
<li class="first active"><%= link_to "#{t("web-app-theme.list", :default => "List")}", users_path %></li> | ||
<li><%= link_to "#{t("web-app-theme.new", :default => "New")}", new_user_path %></li> | ||
</ul> | ||
</div> | ||
<div class="content"> | ||
<h2 class="title"><%= t("web-app-theme.all", :default => "All") %> Users</h2> | ||
<div class="inner"> | ||
<table class="table"> | ||
<tr> | ||
<th class="first">ID</th> | ||
<th> | ||
<%= t("activerecord.attributes.user.login", :default => t("activerecord.labels.login", :default => "Login")) %> | ||
</th> | ||
<th><%= t("web-app-theme.created_at", :default => "Created at") %></th> | ||
<th class="last"> </th> | ||
</tr> | ||
<% @users.each do |user| -%> | ||
<tr class="<%= cycle("odd", "even") %>"> | ||
<td> | ||
<%= user.id %> | ||
</td> | ||
<td> | ||
<%= link_to user.login, user_path(user) %> | ||
</td> | ||
<td> | ||
<%= user.created_at %> | ||
</td> | ||
<td class="last"> | ||
<%= link_to "#{t("web-app-theme.show", :default => "Show")}", user_path(user) %> | | ||
<%= link_to "#{t("web-app-theme.edit", :default => "Edit")}", edit_user_path(user) %> | | ||
<%= link_to "#{t("web-app-theme.delete", :default => "Delete")}", user_path(user), :method => :delete, :confirm => "#{t("web-app-theme.confirm", :default => "Are you sure?")}" %> | ||
</td> | ||
</tr> | ||
<% end -%> | ||
</table> | ||
<div class="actions-bar wat-cf"> | ||
<div class="actions"> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<% content_for :sidebar, render(:partial => 'sidebar') -%> | ||
|
||
<div id="box"> | ||
<div class="block" id="block-signup"> | ||
<h2>Sign Up</h2> | ||
<div class="content"> | ||
<div> </div> | ||
<% form_for :user, :url => users_path, :html => { :class => 'form' } do |f| %> | ||
<%= render :partial => "form", :locals => {:f => f} %> | ||
|
||
<div class="group wat-cf navform"> | ||
<button class="button" type="submit"> | ||
<%= image_tag('web-app-theme/tick.png', :alt => 'Sign Up') %> | ||
Sign Up | ||
</button> | ||
</div> | ||
<% end %> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<div class="block"> | ||
<div class="secondary-navigation"> | ||
<ul class="wat-cf"> | ||
<li class="first"><%= link_to "#{t("web-app-theme.list", :default => "List")}", users_path %></li> | ||
<li><%= link_to "#{t("web-app-theme.new", :default => "New")}", new_user_path %></li> | ||
<li class="active"><%= link_to "#{t("web-app-theme.show", :default => "Show")}", user_path %></li> | ||
</ul> | ||
</div> | ||
<div class="content"> | ||
<div class="inner"> | ||
|
||
<p> | ||
<b><%= t("activerecord.attributes.user.login", :default => t("activerecord.labels.login", :default => "Login")) %>:</b> | ||
<%= @user.login %> | ||
</p> | ||
|
||
<p> | ||
<b><%= t("activerecord.attributes.user.email", :default => t("activerecord.labels.email", :default => "Email")) %>:</b> | ||
<%= @user.email %> | ||
</p> | ||
|
||
<p> | ||
<b><%= t("activerecord.attributes.user.crypted_password", :default => t("activerecord.labels.crypted_password", :default => "Crypted password")) %>:</b> | ||
<%= @user.crypted_password %> | ||
</p> | ||
|
||
<p> | ||
<b><%= t("activerecord.attributes.user.password_salt", :default => t("activerecord.labels.password_salt", :default => "Password salt")) %>:</b> | ||
<%= @user.password_salt %> | ||
</p> | ||
|
||
<p> | ||
<b><%= t("activerecord.attributes.user.persistence_token", :default => t("activerecord.labels.persistence_token", :default => "Persistence token")) %>:</b> | ||
<%= @user.persistence_token %> | ||
</p> | ||
|
||
<p> | ||
<b><%= t("activerecord.attributes.user.single_access_token", :default => t("activerecord.labels.single_access_token", :default => "Single access token")) %>:</b> | ||
<%= @user.single_access_token %> | ||
</p> | ||
|
||
<p> | ||
<b><%= t("activerecord.attributes.user.perishable_token", :default => t("activerecord.labels.perishable_token", :default => "Perishable token")) %>:</b> | ||
<%= @user.perishable_token %> | ||
</p> | ||
|
||
<p> | ||
<b><%= t("activerecord.attributes.user.admin", :default => t("activerecord.labels.admin", :default => "Admin")) %>:</b> | ||
<%= @user.admin %> | ||
</p> | ||
<%= link_to "#{image_tag("web-app-theme/application_edit.png", :alt => "#{t("web-app-theme.edit", :default=> "Edit")}")} #{t("web-app-theme.edit", :default=> "Edit")}", edit_user_path(@user), :class => "button" %> | ||
<%= link_to "#{image_tag("web-app-theme/cross.png", :alt => "#{t("web-app-theme.delete", :default=> "Delete")}")} #{t("web-app-theme.delete", :default => "Delete")}", user_path(@user), :method => "delete", :class => "button", :confirm => "#{t("web-app-theme.confirm", :default => "Are you sure?")}" %> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<% content_for :sidebar, render(:partial => 'sidebar') -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
require 'spec_helper' | ||
|
||
describe UsersController do | ||
|
||
#Delete this example and add some real ones | ||
it "should use UsersController" do | ||
controller.should be_an_instance_of(UsersController) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require 'spec_helper' | ||
|
||
describe UsersHelper do | ||
|
||
#Delete this example and add some real ones or delete this file | ||
it "should be included in the object returned by #helper" do | ||
included_modules = (class << helper; self; end).send :included_modules | ||
included_modules.should include(UsersHelper) | ||
end | ||
|
||
end |