diff --git a/app/controllers/fact_controller.rb b/app/controllers/fact_controller.rb new file mode 100644 index 0000000..7a94945 --- /dev/null +++ b/app/controllers/fact_controller.rb @@ -0,0 +1,12 @@ +class FactController < ApplicationController + def create + Fact.create person: current_person, content: params[:content] + redirect_to '/profile#facts' + end + + def destroy + fact = Fact.find params[:id] + fact.destroy if fact.person = current_person + redirect_to '/profile#facts' + end +end \ No newline at end of file diff --git a/app/controllers/profile_controller.rb b/app/controllers/profile_controller.rb index 4a328d7..f3d584b 100644 --- a/app/controllers/profile_controller.rb +++ b/app/controllers/profile_controller.rb @@ -7,7 +7,7 @@ class ProfileController < ApplicationController def update process_sc_embed_code @person, @person if @person.update_attributes params[:person] - redirect_to '/', notice: 'Profile successfully updated.' + redirect_to profile_url, notice: 'Profile successfully updated.' else render action: 'edit' end diff --git a/app/models/fact.rb b/app/models/fact.rb index 61d4910..cf76963 100644 --- a/app/models/fact.rb +++ b/app/models/fact.rb @@ -1,3 +1,5 @@ class Fact < ActiveRecord::Base attr_accessible :content, :person_id, :person + + belongs_to :person end \ No newline at end of file diff --git a/app/views/layouts/application.html.slim b/app/views/layouts/application.html.slim index bad28e0..cb74a32 100644 --- a/app/views/layouts/application.html.slim +++ b/app/views/layouts/application.html.slim @@ -14,7 +14,7 @@ html div.nav-collapse ul.nav li - = link_to 'profile', person_url + = link_to 'profile', profile_url = yield :menu_items ul.nav.pull-right li diff --git a/app/views/profile/edit.html.slim b/app/views/profile/edit.html.slim index 7473470..bd48508 100644 --- a/app/views/profile/edit.html.slim +++ b/app/views/profile/edit.html.slim @@ -1,6 +1,9 @@ +a name='general' + h1 General + = form_for @person, html: {class: 'form-horizontal'} do |form| fieldset - div.span4 + div.span6 div.control-group label.control-label for="person_full_name" Full Name div.controls @@ -30,4 +33,21 @@ - if @person.photo? img src="#{@person.photo :small}" div.form-actions - = form.submit 'Update Profile', class: 'btn btn-primary' \ No newline at end of file + = form.submit 'Update Profile', class: 'btn btn-primary' + +a name='facts' + h1 Facts + +div.span6 + table class='table-striped' + - @person.facts.each do |fact| + tr + td + p = 'I ' + fact.content + td + = link_to "/fact/#{fact.id}", class: 'd', method: :delete do + i.icon-remove-circle + tr + = form_tag "/fact", class: 'form-inline' do + td + = text_field_tag :content, nil, placeholder: 'I ...' \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 68d6795..d137e47 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -3,9 +3,12 @@ Ocelots::Application.routes.draw do post 'home/verify' => 'home#verify' - get 'person' => 'profile#edit' + get 'profile' => 'profile#edit' put 'person' => 'profile#update' + post 'fact' => 'fact#create' + delete 'fact/:id' => 'fact#destroy' + get 'teams' => 'teams#index' post 'teams' => 'teams#create' get 'teams/:slug' => 'teams#show' diff --git a/vendor/assets/stylesheets/bootstrap.css b/vendor/assets/stylesheets/bootstrap.css index bb40c85..7d27de5 100644 --- a/vendor/assets/stylesheets/bootstrap.css +++ b/vendor/assets/stylesheets/bootstrap.css @@ -1778,7 +1778,7 @@ table .span24 { *margin-right: .3em; line-height: 14px; vertical-align: text-top; - background-image: url("../img/glyphicons-halflings.png"); + background-image: url("/assets/glyphicons-halflings.png"); background-position: 14px 14px; background-repeat: no-repeat; } @@ -1789,7 +1789,7 @@ table .span24 { } .icon-white { - background-image: url("../img/glyphicons-halflings-white.png"); + background-image: url("/assets/glyphicons-halflings-white.png"); } .icon-glass {