Skip to content

Commit

Permalink
Fixing more layout issues
Browse files Browse the repository at this point in the history
  • Loading branch information
guivinicius committed Jun 12, 2012
1 parent e9bbb11 commit b9d9e3f
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 114 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@
/log/*.log
/tmp
/coverage
.rvmrc
.rvmrc
.DS_Store
5 changes: 4 additions & 1 deletion app/controllers/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def new

def edit
@project = Project.find(params[:id])
redirect_to root_path if @project.user_id != current_user.id
end

def create
Expand All @@ -35,6 +36,7 @@ def create

def update
@project = Project.find(params[:id])
redirect_to root_path if @project.user_id != current_user.id

respond_to do |format|
if @project.update_attributes(params[:project])
Expand All @@ -49,6 +51,7 @@ def update

def destroy
@project = Project.find(params[:id])
@project.destroy
@project.destroy if @project.user_id == current_user.id
redirect_to root_path
end
end
19 changes: 9 additions & 10 deletions app/views/devise/registrations/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
<%= devise_error_messages! %>
<%= form_for(resource, :validate => true, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>

<div class="control-group">
<%= f.label :name, :class => "control-label" %>
<%= f.label :name, "Nome", :class => "control-label" %>
<div class="controls">
<%= f.text_field :name %>
</div>
Expand All @@ -16,31 +15,31 @@
</div>

<div class="control-group">
<%= f.label :password, :class => "control-label" %>
<%= f.label :password, "Nova senha", :class => "control-label" %>
<div class="controls">
<%= f.password_field :password %>
<p class="help-block">Deixe em branco caso não queira alterar.</p>
</div>
</div>

<div class="control-group">
<%= f.label :password_confirmation, :class => "control-label" %>
<%= f.label :password_confirmation, "Confirme sua nova senha", :class => "control-label" %>
<div class="controls">
<%= f.password_field :password_confirmation %>
</div>
</div>

<hr>
<div class="control-group">
<%= f.label :current_password, :class => "control-label" %>
<%= f.label :current_password, "Senha atual", :class => "control-label" %>
<div class="controls">
<%= f.password_field :current_password %>
</div>
<p class="help-block">Entre com sua senha atual para confirmar as alterações.</p>
</div>

<%= f.submit "Atualizar", :class => "btn" %>
<%= f.submit "Atualizar", :class => "btn btn-success span3" %>
<% end %>

<h3>Cancel my account</h3>
<hr>

<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p>
<p><%= link_to "Cancelar minha conta", registration_path(resource_name), :confirm => "Tem certeza ?", :method => :delete, :class => "btn btn-danger" %></p>
49 changes: 16 additions & 33 deletions app/views/projects/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,45 +1,28 @@
<%= form_for @project, :validate => true, :html => {:class => "form-horizontal"} do |f| %>
<div class="control-group">
<%= form_for @project, :validate => true do |f| %>

<%= f.label :title, "Título", :class => 'control-label' %>
<div class="controls">
<%= f.text_field :title, :class => 'text_field span4' %>
</div>
</div>
<%= f.text_field :title, :class => 'text_field span6' %>

<div class="control-group">

<%= f.label :description, "Resumo", :class => 'control-label' %>
<div class="controls">
<%= f.text_area :description, :class => 'text_area span4', :rows => 5 %>
</div>
</div>
<%= f.text_area :description, :class => 'text_area span6', :rows => 10 %>

<div class="control-group">
<%= f.label :tag_list, "Palavras-chave", :class => 'control-label' %>
<div class="controls">
<%= f.text_field :tag_list, :class => "span4" %>
<p class="help-block">Palavras separadas por vírgulas. (Games, educação, direito)</p>
</div>
</div>

<div class="control-group">
<%= f.label :tag_list, "Palavras-chave", :class => 'control-label' %>
<%= f.text_field :tag_list, :class => "span6" %>
<p class="help-block">Palavras separadas por vírgulas. (Games, educação, direito)</p>

<%= f.label :college_id, "Instituição", :class => 'control-label' %>
<div class="controls">
<%= f.select :college_id, College.all.collect {|c| [c.name, c.id]}, {}, {:class => "span4"} %>
</div>
</div>
<%= f.select :college_id, College.all.collect {|c| [c.name, c.id]}, {}, {:class => "span6"} %>

<div class="control-group">
<%= f.label :delivery_year, "Ano de Entrega", :class => 'control-label' %>
<div class="controls">
<%= f.date_select :delivery_year, {:discard_day => true, :discard_month => true}, {:class => 'span1'} %>
</div>
</div>
<%= f.date_select :delivery_year, {:discard_day => true, :discard_month => true}, {:class => 'span1'} %>

<%= f.text_field :user_id, :class => "hide" %>
<%= f.text_field :user_id, :class => "hide" %>

<div class="form-actions">
<%= f.submit "Criar Projeto", :class => 'btn btn-primary' %>
<%= link_to "Cancelar", root_path, "data-dismiss" => "modal" %>
</div>
<div class="form-actions">
<%= f.submit :class => 'btn btn-primary' %>
<%= link_to "Deletar Projeto", project_path(@project), :method => :delete, :class => "btn btn-danger pull-right", :confirm => "Tem certeza ?" if controller.action_name == "edit" %>
</div>

<% end %>
6 changes: 5 additions & 1 deletion app/views/projects/_projects_table.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
<tr>
<td>
<%= p.title %>
<%= link_to "Ver", project_path(p), :class => "btn btn-success btn-mini pull-right" %>

</td>
<td>
<%= link_to "Ver", project_path(p), :class => "btn btn-success btn-mini" %>
<%= link_to "Editar", edit_project_path(p), :class => "btn btn-warning btn-mini" if p.user_id == current_user.id %>
</td>
</tr>
<% end -%>
Expand Down
3 changes: 0 additions & 3 deletions app/views/projects/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
<%- model_class = @project.class -%>
<h1><%=t '.title', :default => t('helpers.titles.edit', :model => model_class.model_name.human,
:default => "Edit #{model_class.model_name.human}") %></h1>
<%= render :partial => 'form' %>
6 changes: 4 additions & 2 deletions app/views/projects/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
<h6>Autor: <%= @project.user.name %></h6>
<hr>
<div class="description lead">
<p><%= @project.description %></p>
<p><%= simple_format @project.description %></p>
</div>
<hr>
<p class="tags">
<% @project.tags.each do |t|%>
<span class="label label-info"><%= t.name %></span>
<% end -%>
</p>
</p>
<hr>
<%= link_to "Editar Projeto", edit_project_path(p), :class => "btn btn-warning" if @project.user_id == current_user.id %>
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Application < Rails::Application
# config.time_zone = 'Central Time (US & Canada)'

# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}').to_s]
config.i18n.default_locale = "pt-BR"

# Configure the default encoding used in templates for Ruby 1.9.
Expand Down
File renamed without changes.
File renamed without changes.
57 changes: 0 additions & 57 deletions config/locales/devise.en.yml

This file was deleted.

5 changes: 0 additions & 5 deletions config/locales/en.yml

This file was deleted.

8 changes: 8 additions & 0 deletions config/locales/models/project/pt-BR.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pt-BR:
activerecord:
models:
project: Projeto
attributes:
project:
title: "Título"
description: "Resumo"

0 comments on commit b9d9e3f

Please sign in to comment.