Skip to content

Commit 991ffb2

Browse files
committed
Revert "Refactored user profiles"
This reverts commit ec58f80. Conflicts: app/views/devise/registrations/edit.html.haml
1 parent 7269df2 commit 991ffb2

11 files changed

Lines changed: 85 additions & 97 deletions

File tree

app/assets/stylesheets/application.css.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,4 @@
1515
@import "home.css.scss";
1616
@import "questions.css.scss";
1717
@import "programs.css.scss";
18-
@import "users.css.scss";
1918

app/assets/stylesheets/content.css.scss

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,6 @@ h2 {
1111
margin-bottom: 0.5em;
1212
}
1313

14-
.heading {
15-
@include clearfix;
16-
padding: 0.75em;
17-
background: $green;
18-
19-
h3, .description {
20-
color: white;
21-
}
22-
23-
h3 {
24-
float: left;
25-
margin-bottom: 0;
26-
margin-right: 1em;
27-
}
28-
.description {
29-
float: left;
30-
margin-top: 0.2em;
31-
}
32-
}
33-
34-
3514
.block-message {
3615
margin-bottom: 0.5em;
3716
p {

app/assets/stylesheets/layout.css.scss

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,9 @@ html {
33
}
44

55
body {
6-
color: $text-color;
76
background: $background url("square_bg.png") fixed;
87
}
98

10-
p,h1,h2,h3,h4,h5 {
11-
color: $text-color;
12-
}
13-
149
.topbar {
1510
position: relative;
1611
height: auto;
@@ -91,6 +86,9 @@ header .topbar-inner {
9186

9287
}
9388

89+
p,h1,h2,h3,h4,h5 {
90+
color: $text-color;
91+
}
9492

9593
.alert-message {
9694
margin-top: -18px;

app/assets/stylesheets/programs.css.scss

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
11
.programs {
22

33
margin-bottom: 2em;
4+
.heading {
5+
@include clearfix;
6+
padding: 0.75em;
7+
background: $green;
8+
9+
h3, .description {
10+
color: white;
11+
}
12+
13+
h3 {
14+
float: left;
15+
margin-bottom: 0;
16+
margin-right: 1em;
17+
}
18+
.description {
19+
float: left;
20+
margin-top: 0.2em;
21+
}
22+
}
23+
424

525
ul {
626
@include clearfix;

app/assets/stylesheets/users.css.scss

Lines changed: 0 additions & 23 deletions
This file was deleted.

app/models/answer.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ class Answer
22
include MongoMapper::Document
33

44
key :description, String
5-
timestamps!
65

76
validates_presence_of :description
87

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<% content_for :title do %>
2+
Edit <%= resource_name.to_s.humanize %>
3+
<% end %>
4+
5+
<%= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
6+
<%= f.error_notification %>
7+
8+
<div class="inputs">
9+
<%= f.input :username, :autofocus => true %>
10+
<%= f.input :email, :autofocus => true %>
11+
<%= f.input :password, :hint => "leave it blank if you don't want to change it", :required => false %>
12+
<%= f.input :password_confirmation, :required => false %>
13+
<%= f.input :current_password, :hint => "we need your current password to confirm your changes", :required => true %>
14+
<%= f.input :about %>
15+
</div>
16+
17+
<div class="actions">
18+
<%= f.button :submit, "Update" %>
19+
</div>
20+
<% end %>
21+
22+
<h3>Cancel my account</h3>
23+
24+
<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p>
25+
26+
<%= link_to "Back", :back %>

app/views/devise/registrations/edit.html.haml

Lines changed: 0 additions & 22 deletions
This file was deleted.

app/views/users/_form.html.erb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<%= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
2+
<%= f.error_notification %>
3+
4+
<div class="inputs">
5+
<%= f.input :username, :autofocus => true %>
6+
<%= f.input :email %>
7+
<%= f.input :password %>
8+
<%= f.input :password_confirmation %>
9+
<%= f.input :about, :as => :text %>
10+
</div>
11+
12+
<div class="actions">
13+
<%= f.button :submit, "Sign up", :class => "btn primary" %>
14+
</div>
15+
<% end %>

app/views/users/show.html.haml

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
- content_for :title do
2-
= "#{resource.username}'s Profile"
2+
= "#{resource.username}'s page"
33

44
-content_for :sidebar do
55
%section.about-user
@@ -14,8 +14,9 @@
1414
= f.hidden_field :followee, :value => resource.id
1515
= f.button :submit, :value => "Follow", :class => "primary btn"
1616

17-
- unless resource.about.blank?
18-
%p= resource.about
17+
%h2= "About #{resource.username}"
18+
%h4= resource.about
19+
%hr
1920
%p
2021
= link_to pluralize(resource.programs.count, "Program"), user_programs_path(resource)
2122
%p
@@ -30,25 +31,21 @@
3031

3132

3233
- unless @user.questions.empty?
33-
%section.user-questions
34-
.heading
35-
%h3= pluralize(@user.questions.count, "Question")
36-
%ul
37-
- @user.questions.each do |question|
38-
%li
39-
.title
40-
= link_to question.title, question_path(question)
41-
.meta
42-
asked #{question.created_at.strftime("%b %e, %l:%M %p")}
34+
%section.questions
35+
%header
36+
%h2 Questions
37+
- @user.questions.each do |question|
38+
%article.question
39+
%h4= link_to question.title, question_path(question)
4340

4441
- unless @user.answers.empty?
45-
%section.user-answers
46-
.heading
47-
%h3= pluralize(@user.answers.count, "Answer")
48-
%ul
49-
- @user.answers.each do |answer|
50-
%li
51-
.description
52-
= answer.description.truncate(100)
53-
.meta
54-
= link_to("View Answer", answer.question)
42+
%section.answers
43+
%header
44+
%h2 Answers
45+
- @user.answers.each do |answer|
46+
%article.answer
47+
%h4
48+
= "#{@user.username} answered"
49+
= link_to(answer.question.title, answer.question)
50+
with:
51+
%p= answer.description

0 commit comments

Comments
 (0)