added edit abilities

This commit is contained in:
Connor Turland 2012-09-23 21:30:48 -04:00
parent 392a187b1c
commit ea7aa9815a
21 changed files with 164 additions and 64 deletions

View file

@ -26,6 +26,13 @@ h2 {display:block; text-align:center; background: #333; font-size:24px;}
a {color:#2d6a5d; text-decoration:none;}
.clearfloat {clear:both;}
form { display: block; width: 350px; margin: 0 auto; background: #D1D1D1; padding: 20px; border-radius: 15px; color: #000; }
label, select, input, textarea { display:block; }
label { margin-top:5px; }
input[type="submit"] { margin-top:5px; }
.contentarea p, .contentarea ul , .contentarea ol, .contentarea table {font-size:14px; line-height:1.55em; padding:0.5em 0}
.contentarea ul li {padding:0.2em 0; }
.contentarea ol li {padding:0.2em 0; }
@ -56,3 +63,6 @@ a {color:#2d6a5d; text-decoration:none;}
.focus .desc { font-style:italic; padding:10px; }
.focus .desc h3 { font-style:normal; }
.focus .link { padding:0 0 0 10px; display:block; width:90%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.divider { margin: 20px 50px 20px 50px; border-bottom:2px solid #FFF; }
.empty { margin-left:50px; }

View file

@ -2,13 +2,21 @@
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
.group { display:block; float:left; position:relative; width:155px; height:265px; padding:10px 10px 10px 35px; background:#d1d1d1; border-radius:15px; margin:15px 0 15px 50px; color:#000; }
.group { display:block; float:left; position:relative; width:155px; height:265px; padding:10px 10px 10px 35px; background:#d1d1d1; border-radius:15px; margin:30px 0 30px 50px; color:#000; }
.group .type {position: absolute;
color: white;
top: -22px;
right: 0;
font-weight: bold;
font-size: 20px;
line-height: 24px;}
.group .icon { position:absolute; top:117px; left:-25px; }
.group .title { font-size:22px; line-height:25px; display:block; border-bottom:2px solid #000; padding-bottom:5px; }
.group .desc { font-style:italic; }
.group .desc { font-style:italic; overflow-y:scroll;}
.group .desc h3 { font-style:normal; margin-top:5px; }
.group .link { position:absolute; width:155px; top:260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

View file

@ -2,13 +2,21 @@
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
.item { display:block; float:left; position:relative; width:155px; height:265px; padding:10px 10px 10px 35px; background:#d1d1d1; border-radius:15px; margin:15px 0 15px 50px; color:#000; }
.item { display:block; float:left; position:relative; width:155px; height:265px; padding:10px 10px 10px 35px; background:#d1d1d1; border-radius:15px; margin:30px 0 30px 50px; color:#000; }
.item .type {position: absolute;
color: white;
top: -22px;
right: 0;
font-weight: bold;
font-size: 20px;
line-height: 24px;}
.item .icon { position:absolute; top:117px; left:-25px; }
.item .title { font-size:22px; line-height:25px; display:block; border-bottom:2px solid #000; padding-bottom:5px; }
.item .desc { font-style:italic; }
.item .desc { font-style:italic; overflow-y:scroll;}
.item .desc h3 { font-style:normal; margin-top:5px; }
.item .link { position:absolute; width:155px; top:260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

View file

@ -2,13 +2,21 @@
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
.person { display:block; float:left; position:relative; width:155px; height:265px; padding:10px 10px 10px 35px; background:#d1d1d1; border-radius:15px; margin:15px 0 15px 50px; color:#000; }
.person { display:block; float:left; position:relative; width:155px; height:265px; padding:10px 10px 10px 35px; background:#d1d1d1; border-radius:15px; margin:30px 0 30px 50px; color:#000; }
.person .type {position: absolute;
color: white;
top: -22px;
right: 0;
font-weight: bold;
font-size: 20px;
line-height: 24px;}
.person .icon { position:absolute; top:117px; left:-25px; }
.person .title { font-size:22px; line-height:25px; display:block; border-bottom:2px solid #000; padding-bottom:5px; }
.person .desc { font-style:italic; }
.person .desc { font-style:italic; overflow-y:scroll;}
.person .desc h3 { font-style:normal; margin-top:5px; }
.person .link { position:absolute; width:155px; top:260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

View file

@ -63,10 +63,17 @@ class ItemsController < ApplicationController
def update
@user = current_user
@item = Item.find_by_id(params[:id])
@item.attributes = params[:action] if @item
@item.save if @item
if @item
@item.name = params[:item][:name]
@item.desc = params[:item][:desc]
@item.link = params[:item][:link]
@item.item_category = ItemCategory.find(params[:category])
@item.user = @user
@item.save
end
respond_with(@user, location: restore(default: root_url)) do |format|
end
end

View file

@ -1,6 +1,8 @@
<%= div_for group do %>
<p class="type">Group</p>
<%= image_tag "group.png", :class => 'icon' %>
<%= link_to group.name, group_url(group), :class => 'title' %>
<div class="desc"><h3>About</h3><%= group.desc %></div>
<div class="desc"><p><%= group.desc %></p></div>
<%= link_to group.link, group.link, :class => 'link' %>
<% end %>

View file

@ -0,0 +1,10 @@
<%= form_for @group, url: group_url do |form| %>
<h3>Edit Group</h3>
<label for="group_name">Name</label>
<%= form.text_field :name, label: "Name", class: "name" %>
<label for="group_desc">Description</label>
<%= form.text_area :desc, label: "Description", class: "description", :rows => 5 %>
<label for="group_link">Link</label>
<%= form.text_field :link, label: "Link", class: "link" %>
<%= form.submit "Update", class: "update" %>
<% end %>

View file

@ -1,8 +1,10 @@
<%= form_for @group || Group.new, url: groups_path do |form| %>
<h3>Add Group</h3>
<label for="group_name">Name</label>
<%= form.text_field :name, label: "Name", class: "name" %>
<%= form.text_field :desc, label: "Description", class: "description" %>
<label for="group_desc">Description</label>
<%= form.text_area :desc, label: "Description", class: "description", :rows => 5 %>
<label for="group_link">Link</label>
<%= form.text_field :link, label: "Link", class: "link" %>
<%= form.submit "Add Group", class: "add" %>
<% end %>

View file

@ -4,9 +4,8 @@
<%= image_tag "group.png", :class => 'icon' %>
</div>
<div class="focusmiddle">
<h1 class="title"><%= @group.name %></h1>
<h1 class="title"><%= @group.name %> <%= link_to "[edit]", edit_group_path(@group) %></h1>
<div class="desc">
<h3>About</h3>
<p><%= @group.desc %></p>
</div>
</div>
@ -18,41 +17,45 @@
<div class="clearfloat nodemargin"></div>
<div class="groups">
<div class="divider"><%= @group.name %> is included in these groups</div>
<% @gparents.each do |group| %>
<%= render group %>
<% end %>
<% if @gparents.empty? %>
<p><br>Shucks, there are no groups.<p>
<% end %>
<p class="empty">Shucks, there are no groups.</p>
<% end %>
</div>
<div class="clearfloat"></div>
<div class="groups">
<div class="divider"><%= @group.name %> includes these groups</div>
<% @gchildren.each do |group| %>
<%= render group %>
<% end %>
<% if @gchildren.empty? %>
<p><br>Shucks, there are no groups.<p>
<% end %>
<p class="empty">Shucks, there are no groups.</p>
<% end %>
</div>
<div class="clearfloat"></div>
<div class="people">
<div class="divider"><%= @group.name %> includes these people</div>
<% @pchildren.each do |people| %>
<%= render people %>
<% end %>
<% if @pchildren.empty? %>
<p><br>Shucks, there are no people.<p>
<p class="empty">Shucks, there are no people.</p>
<% end %>
</div>
<div class="clearfloat"></div>
<div class="items">
<div class="divider"><%= @group.name %> includes these items</div>
<% @ichildren.each do |item| %>
<%= render item %>
<% end %>
<% if @ichildren.empty? %>
<p><br>Shucks, there are no items.<p>
<p class="empty">Shucks, there are no items.</p>
<% end %>
</div>
<div class="clearfloat"></div>

View file

@ -1,6 +1,7 @@
<%= div_for item do %>
<p class="type"><%= item.item_category.name %></p>
<%= image_tag item.item_category.icon, :class => 'icon' %>
<%= link_to item.name, item_url(item), :class => 'title' %>
<div class="desc"><h3>About</h3><%=item.desc %></div>
<div class="desc"><p><%=item.desc %></p></div>
<%= link_to item.link, item.link, :class => 'link' %>
<% end %>

View file

@ -0,0 +1,12 @@
<%= form_for @item, url: item_url do |form| %>
<h3>Edit Item</h3>
<label for="category">Category</label>
<%= select_tag "category", options_from_collection_for_select(ItemCategory.all, "id", "name") %>
<label for="item_name">Title</label>
<%= form.text_field :name %>
<label for="item_desc">Description</label>
<%= form.text_area :desc, class: "description", :rows => 5 %>
<label for="item_link">Link</label>
<%= form.text_field :link, class: "link" %>
<%= form.submit "Update", class: "update" %>
<% end %>

View file

@ -1,8 +1,12 @@
<%= form_for @item || Item.new, url: items_path do |form| %>
<h3>Add Item</h3>
<label for="category">Category</label>
<%= select_tag "category", options_from_collection_for_select(ItemCategory.all, "id", "name") %>
<%= form.text_field :name, label: "Name", class: "name" %>
<%= form.text_field :desc, label: "Description", class: "description" %>
<%= form.text_field :link, label: "Link", class: "link" %>
<label for="item_name">Title</label>
<%= form.text_field :name %>
<label for="item_desc">Description</label>
<%= form.text_area :desc, class: "description", :rows => 5 %>
<label for="item_link">Link</label>
<%= form.text_field :link, class: "link" %>
<%= form.submit "Add Item", class: "add" %>
<% end %>

View file

@ -5,9 +5,8 @@
<%= image_tag @item.item_category.icon, :class => 'icon' %>
</div>
<div class="focusmiddle">
<h1 class="title"><%= @item.name %></h1>
<h1 class="title"><%= @item.name %> <%= link_to "[edit]", edit_item_path(@item) %></h1>
<div class="desc">
<h3>About</h3>
<p><%= @item.desc %></p>
</div>
</div>
@ -19,41 +18,45 @@
<div class="clearfloat nodemargin"></div>
<div class="groups">
<div class="divider"><%= @item.name %> is included in these groups</div>
<% @gparents.each do |group| %>
<%= render group %>
<% end %>
<% if @gparents.empty? %>
<p><br>Shucks, there are no groups.<p>
<p class="empty">Shucks, there are no groups.</p>
<% end %>
</div>
<div class="clearfloat"></div>
<div class="parents">
<div class="divider"><%= @item.name %> is included by these people</div>
<% @pparents.each do |person| %>
<%= render person %>
<% end %>
<% if @pparents.empty? %>
<p><br>Shucks, there are no people.<p>
<p class="empty">Shucks, there are no people.</p>
<% end %>
</div>
<div class="clearfloat"></div>
<div class="items">
<div class="divider"><%= @item.name %> is included by these items</div>
<% @iparents.each do |item| %>
<%= render item %>
<% end %>
<% if @iparents.empty? %>
<p><br>Shucks, there are no items.<p>
<p class="empty">Shucks, there are no items.</p>
<% end %>
</div>
<div class="clearfloat"></div>
<div class="items">
<div class="divider"><%= @item.name %> includes these items</div>
<% @ichildren.each do |item| %>
<%= render item %>
<% end %>
<% if @ichildren.empty? %>
<p><br>Shucks, there are no items.<p>
<p class="empty">Shucks, there are no items.</p>
<% end %>
</div>
<div class="clearfloat"></div>

View file

@ -3,7 +3,6 @@
<head>
<title>Metamap</title>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= stylesheet_link_tag 'style.css' %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
@ -15,16 +14,23 @@
<% unless authenticated? %>
<ul>
<li><%= link_to "Login", new_session_path, id: "Login" %></li>
<li><%= link_to "Create Account", new_user_path, id: "CreateAccount" %></li>
<li>|</li>
<li><%= link_to "Items", items_path %></li>
<li><%= link_to "People", people_path %></li>
<li><%= link_to "Groups", groups_path %></li>
</ul>
<% end %>
<% if authenticated? %>
<ul>
<li><%= link_to "Logout", session_path, method: 'delete', id: "Login" %></li>
<li><%= link_to "New Item", new_item_path %></li>
<li>|</li>
<li><%= link_to "Add Item", new_item_path %></li>
<li><%= link_to "Add Person", new_person_path %></li>
<li><%= link_to "Add Group", new_group_path %></li>
<li>|</li>
<li><%= link_to "Items", items_path %></li>
<li><%= link_to "New Person", new_person_path %></li>
<li><%= link_to "People", people_path %></li>
<li><%= link_to "New Group", new_group_path %></li>
<li><%= link_to "Groups", groups_path %></li>
</ul>
<% end %>

View file

@ -1,6 +1,7 @@
<%= div_for person do %>
<p class="type">Person</p>
<%= image_tag "person.png", :class => 'icon' %>
<%= link_to person.name, person_url(person), :class => 'title' %>
<div class="desc"><h3>About</h3><%=person.desc %></div>
<div class="desc"><p><%=person.desc %></p></div>
<%= link_to person.link, person.link, :class => 'link' %>
<% end %>

View file

@ -0,0 +1,10 @@
<%= form_for @person, url: person_url do |form| %>
<h3>Edit Person</h3>
<label for="person_name">Name</label>
<%= form.text_field :name, label: "Name", class: "name" %>
<label for="person_desc">Description</label>
<%= form.text_area :desc, label: "Description", class: "description", :rows => 5 %>
<label for="person_link">Link</label>
<%= form.text_field :link, label: "Link", class: "link" %>
<%= form.submit "Update", class: "update" %>
<% end %>

View file

@ -1,8 +1,12 @@
<%= form_for @person || Person.new, url: people_path do |form| %>
<h3>Add Person</h3>
<label for="person_name">Name</label>
<%= form.text_field :name, label: "Name", class: "name" %>
<%= form.text_field :desc, label: "Description", class: "description" %>
<label for="person_desc">Description</label>
<%= form.text_area :desc, label: "Description", class: "description", :rows => 5 %>
<label for="person_link">Link</label>
<%= form.text_field :link, label: "Link", class: "link" %>
<label for="ingroups">In These Groups</label>
<%= select_tag "ingroups", options_from_collection_for_select(Group.all, "id", "name"), { :multiple => true } %>
<%= form.submit "Add Person", class: "add" %>
<%= form.submit "Add Person", class: "add" %>
<% end %>

View file

@ -4,9 +4,8 @@
<%= image_tag "person.png", :class => 'icon' %>
</div>
<div class="focusmiddle">
<h1 class="title"><%= @person.name %></h1>
<h1 class="title"><%= @person.name %> <%= link_to "[edit]", edit_person_path(@person) %></h1>
<div class="desc">
<h3>About</h3>
<p><%= @person.desc %></p>
</div>
</div>
@ -19,21 +18,23 @@
<div class="clearfloat nodemargin"></div>
<div class="groups">
<div class="divider"><%= @person.name %> is included in these groups</div>
<% @gparents.each do |group| %>
<%= render group %>
<% end %>
<% if @gparents.empty? %>
<p><br>Shucks, there are no groups.<p>
<p class="empty">Shucks, there are no groups.</p>
<% end %>
</div>
<div class="clearfloat"></div>
<div class="items">
<div class="divider"><%= @person.name %> includes these items</div>
<% @ichildren.each do |item| %>
<%= render item %>
<% end %>
<% if @ichildren.empty? %>
<p><br>Shucks, there are no items.<p>
<p class="empty">Shucks, there are no items.</p>
<% end %>
</div>
<div class="clearfloat"></div>

View file

@ -1,7 +1,8 @@
<%= form_for @session || Session.new, url: session_path do |form| %>
<%= form.text_field :email, label: "Email", class: "email" %>
<%= form.password_field :password, label: "Password", class: "password" %>
<%= form.submit "Login", class: "add" %>
<h3>Login</h3>
<label for="session_email">Email</label>
<%= form.text_field :email, class: "email" %>
<label for="session_password">Password</label>
<%= form.password_field :password, class: "password" %>
<%= form.submit "Login", class: "add" %>
<% end %>

View file

@ -1,10 +1,9 @@
<%= formula_form_for @user, url: user_url do |form| %>
<h3>Create Account</h3>
<%= form.input :name, label: "Name", class: "name" %>
<%= form.input :email, label: "Email", class: "email" %>
<%= form.input :password, label: "Password", class: "password" %>
<%= form.submit "Login", class: "add" %>
<%= form.submit "Login", class: "add" %>
<% end %>

View file

@ -1,32 +1,32 @@
development:
min_messages: WARNING
adapter: postgresql
host: 127.0.0.1
host: ec2-54-243-217-241.compute-1.amazonaws.com
port: 5432
encoding: unicode
database: issad-development
database: dbct9hosrirq2h
pool: 5
username: postgres
password: "3112"
username: tkbwavghytilon
password: "To6z-64f1Lr3LqpWrcLBPG2Xdv"
test:
min_messages: WARNING
adapter: postgresql
host: 127.0.0.1
host: ec2-54-243-217-241.compute-1.amazonaws.com
port: 5432
encoding: unicode
database: issad-test
database: dbct9hosrirq2h
pool: 5
username: postgres
password: "3112"
username: tkbwavghytilon
password: "To6z-64f1Lr3LqpWrcLBPG2Xdv"
production:
min_messages: WARNING
adapter: postgresql
host: 127.0.0.1
host: ec2-54-243-217-241.compute-1.amazonaws.com
port: 5432
encoding: unicode
database: issad-production
database: dbct9hosrirq2h
pool: 5
username: postgres
password: "3112"
username: tkbwavghytilon
password: "To6z-64f1Lr3LqpWrcLBPG2Xdv"