diff --git a/app/assets/javascripts/local.js b/app/assets/javascripts/local.js index 427e4ee..caee771 100644 --- a/app/assets/javascripts/local.js +++ b/app/assets/javascripts/local.js @@ -152,8 +152,8 @@ $(function() { }); // User page - $("td#userNavi > div > a").click(function(){ - $("td#userData").fadeOut("fast"); + $("#user-profile li a").click(function(){ + $("#user-data").fadeOut("fast"); $.ajax({ type: "GET", url: window.location.protocol + "//" + window.location.host + "/" + window.location.pathname + ".js?page=" + $(this).attr('id'), diff --git a/app/assets/stylesheets/layout/_body.scss b/app/assets/stylesheets/layout/_body.scss index 5f90123..20ad9bd 100644 --- a/app/assets/stylesheets/layout/_body.scss +++ b/app/assets/stylesheets/layout/_body.scss @@ -8,6 +8,7 @@ body { padding: 0; width: 100%; min-height: 100%; + background-color: transparent; } body { diff --git a/app/assets/stylesheets/pages/_contests.scss b/app/assets/stylesheets/pages/_contests.scss index 856dd07..6216300 100644 --- a/app/assets/stylesheets/pages/_contests.scss +++ b/app/assets/stylesheets/pages/_contests.scss @@ -2,7 +2,7 @@ Contester */ -#matches { +div#matches { @include span-columns(12); margin: em(20) 0; } diff --git a/app/assets/stylesheets/pages/_matches.scss b/app/assets/stylesheets/pages/_matches.scss index ac8c637..e6a2fb5 100644 --- a/app/assets/stylesheets/pages/_matches.scss +++ b/app/assets/stylesheets/pages/_matches.scss @@ -2,7 +2,7 @@ Matches Listing */ -#matches { +table#matches { width: 100%; display: table; table-layout: auto; diff --git a/app/assets/stylesheets/pages/_users.scss b/app/assets/stylesheets/pages/_users.scss index fbd53b6..1ea124d 100644 --- a/app/assets/stylesheets/pages/_users.scss +++ b/app/assets/stylesheets/pages/_users.scss @@ -54,6 +54,26 @@ } } +#user-profile { + + .photo { + @include span-columns(12); + margin: em(20) 0; + text-align: center; + + img { + display: inline-block; + float: none; + width: auto; + } + } + + #user-data { + @include span-columns(12); + margin-bottom: em(20); + } +} + /* Agenda */ diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e8b807f..ac0751c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -54,18 +54,19 @@ module ApplicationHelper def printtime time, format return unless time + out = "" out << '' out << time.strftime(format) out << '' - raw out + + out.html_safe end def cascade model, list - out = "" - - list.each do |element| + out = list.map do |element| name = key = element + item = "" result = "" if element.instance_of?(Array) @@ -91,12 +92,19 @@ module ApplicationHelper result << h(str) end - out << "

" - out << "#{name.to_s.capitalize.gsub(/_s/, '').gsub(/_/, ' ')}: " - out << result - out << "

" + item << content_tag(:dt) do + "#{name.to_s.capitalize.gsub(/_s/, '').gsub(/_/, ' ')}" + end + item << content_tag(:dd) do + result + end + + item + end + + content_tag(:dl) do + out.join.html_safe end - raw out end def abslink text, url diff --git a/app/views/users/_general.html.erb b/app/views/users/_general.html.erb index da9692e..0fbecf4 100644 --- a/app/views/users/_general.html.erb +++ b/app/views/users/_general.html.erb @@ -1,8 +1,6 @@ -

- General information -

+
+

General information

-
<%= cascade @user, ["steamid"] %> <%= link_to "http://steamidfinder.com/?STEAM_#{@user.steamid}" do %> Search for corresponding Steam account @@ -12,17 +10,17 @@ <%= cascade @user.profile, ["town"] %>
-

- Miscellaneous -

-
+ +
+

Miscellaneous

+

- Joined: <%= longtime @user.created_at %> -

+ Joined: <%= longtime @user.created_at %> +

-

- Lastvisit: <%= longtime @user.lastvisit %> +

+ Last visit: <%= longtime @user.lastvisit %>

<% if cuser and cuser.admin? %> @@ -31,7 +29,7 @@

<% end %> -<%= cascade @user, [ ["Comments", "posted_comments.count"], ["Matches", "matches.count"]] %> +<%= cascade @user, [["Comments", "posted_comments.count"], ["Matches", "matches.count"]] %> <% if @user.groups.count > 0 %>

@@ -56,8 +54,8 @@ Contact -

- <%= cascade @user.profile, ["irc", "msn", "icq", "web"] %> +
+ <%= cascade @user.profile, ["web"] %> <% if cuser and cuser.admin? or @user.public_email %> <%= cascade @user, ["email_s"] %> @@ -83,7 +81,7 @@ Achievements -
+
<%= raw @user.profile.achievements_parsed %>
<% end %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 92aaf58..35e56ab 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,72 +1,47 @@ - - - + <% if @user.movies.count > 0 %> +
  • Movies
  • + <% end %> - - -
    -
    - <%= image_tag @user.profile.avatar.url, :id => "user" %> +
    +

    + <%= @user.username %> +

    -
    - <%= @user.username %> -
    -
    +
    + <%= image_tag @user.profile.avatar.url %> +
    -
    - -
    - General -
    - -
    - Favorites -
    - -
    - Computer -
    - - <% if @user.articles.count > 0 %> -
    - Articles -
    - <% end %> - - <% if @user.movies.count > 0 %> -
    - Movies -
    - <% end %> +
    +
      +
    • General
    • <% if @user.teamers.past.count > 0 %> -
      - Teams -
      +
    • Teams
    • <% end %> <% if @user.match_teams.count > 0 %> -
      - Matches -
      +
    • Matches
    • <% end %> <% if @user.predictions.count > 0 %> - +
    • Predictions
    • <% end %> -
      - Comments -
      + <% if @user.articles.count > 0 %> +
    • Articles
    • + <% end %> -
      - <% if cuser and @user.can_update? cuser %> - <%= link_to 'Edit', edit_user_path(@user) %> - <%= link_to 'My Agenda', "/users/agenda/#{cuser.id}" %> - <% end %> -
      -
    +
  • Comments
  • + + +
    <%= render :partial => "general" %> -
    +
    +
    + + <% if cuser and @user.can_update? cuser %> + <%= link_to 'Edit', edit_user_path(@user), class: 'button' %> + <%= link_to 'My Agenda', "/users/agenda/#{cuser.id}", class: 'button' %> + <% end %> +
    + diff --git a/app/views/users/show.js.erb b/app/views/users/show.js.erb index 8ec3391..1d7eade 100644 --- a/app/views/users/show.js.erb +++ b/app/views/users/show.js.erb @@ -1,7 +1,8 @@ -$("td#userData").fadeIn("fast"); -$("td#userData").html("<%= escape_javascript(render(:partial => @page)) %>"); +$("#user-data").fadeIn("fast"); +$("#user-data").html("<%= escape_javascript(render(:partial => @page)) %>"); + <% if ["comments", "matches", "predictions", "teams"].include? @page %> - $("td#userData").removeClass("box"); + $("#user-data").removeClass("box"); <% else %> -$("td#userData").addClass("box"); + $("#user-data").addClass("box"); <% end %> \ No newline at end of file