Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve lists #72

Merged
merged 5 commits into from
Sep 3, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ GEM
hike (1.2.3)
http_accept_language (2.0.1)
http_parser.rb (0.6.0)
i18n (0.6.9)
i18n (0.6.11)
i18n-tasks (0.4.2)
activesupport
easy_translate (>= 0.5.0)
Expand Down Expand Up @@ -218,7 +218,7 @@ GEM
mini_magick (3.7.0)
subexec (~> 0.2.1)
mini_portile (0.6.0)
minitest (5.3.4)
minitest (5.4.1)
multi_json (1.10.1)
multi_xml (0.5.5)
multipart-post (2.0.0)
Expand All @@ -236,7 +236,7 @@ GEM
rack (~> 1.2)
oily_png (1.1.1)
chunky_png (~> 1.3.0)
paper_trail (3.0.3)
paper_trail (3.0.5)
activerecord (>= 3.0, < 5.0)
activesupport (>= 3.0, < 5.0)
pg (0.17.1)
Expand Down Expand Up @@ -380,7 +380,7 @@ GEM
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
tzinfo (1.2.1)
tzinfo (1.2.2)
thread_safe (~> 0.1)
uglifier (2.5.1)
execjs (>= 0.3.0)
Expand Down
1 change: 1 addition & 0 deletions app/assets/javascripts/components/list.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ App.components.list = ->
itemSelector: ".list .list-item"
prefill: on
dataType: "html"
pathParse: (path) -> path.match(/^(.*?page=)[0-9]+(.*|$)/).slice(1)

initialize: ->
options = @handleOptions()
Expand Down
7 changes: 7 additions & 0 deletions app/assets/stylesheets/core/_base.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,10 @@ body .mce-menu-item .mce-text {
width: 18em;
font-size: 12px;
}

p.empty {
text-align: center;
font-weight: bold;
margin: 30px 0;
color: $grey;
}
7 changes: 0 additions & 7 deletions app/assets/stylesheets/relations.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,6 @@
}
}
}

.empty {
text-align: center;
font-weight: bold;
margin: 30px 0;
color: $grey;
}
}

&.edit {
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/activities_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ def user_activity
private

def find_user
@user ||= User.find(id: params[:user_id])
@user ||= User.find(params[:id])
end
end
17 changes: 17 additions & 0 deletions app/views/activities/_user_activities_list.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

<section>
<br>
<h2><%= icon "clock-o", t('users.profile.activity') %></h2>
<div id="activity" data-components="list">
<div id="activities-pagination"><%= paginate @activities, :remote => true %></div>
<ul id="activities-list" class="list activities-list">
<% unless @activities.empty? %>
<% @activities.each do |activity| %>
<%= render 'activities/user_activity', activity: ActivityPresenter.new(object: activity, ctx: self) %>
<% end %>
<% else %>
<p class="empty"><%= t 'activities.empty', {name: @user.name} %></p>
<% end %>
</ul>
</div>
</section>
12 changes: 12 additions & 0 deletions app/views/activities/user_activity.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<% if request.xhr? %>

<%= render 'activities/user_activities_list' %>

<% else %>

<%= render 'shared/object',
presenter: ObjectPresenter.new(object: @user, ctx: self,
show_location: false, content: 'activities/user_activities_list')
%>

<% end %>
2 changes: 1 addition & 1 deletion app/views/contributings/_contributions.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<% unless @contributions.empty? %>
<%= render @contributions, :size => :small %>
<% else %>
<p><%= t 'contributings.empty.contributions' %></p>
<p class="empty"><%= t 'contributings.empty.contributions' %></p>
<% end %>
</ul>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/contributings/_contributors.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<% unless @contributors.empty? %>
<%= render @contributors, :size => :small %>
<% else %>
<p><%= t 'contributings.empty.contributors' %></p>
<p class="empty"><%= t 'contributings.empty.contributors' %></p>
<% end %>
</ul>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/followings/_followers.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<% unless @followers.empty? %>
<%= render @followers, :size => :small %>
<% else %>
<p><%= t 'followings.empty.followers', {name: @followable.try(:name)} %></p>
<p class="empty"><%= t 'followings.empty.followers', {name: @followable.try(:name)} %></p>
<% end %>
</ul>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/followings/_following.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<% unless @following.empty? %>
<%= render @following, :size => :small, :control_type => :follow_button %>
<% else %>
<p><%= t 'followings.empty.following', {name: @followable.try(:name)} %></p>
<p class="empty"><%= t 'followings.empty.following', {name: @followable.try(:name)} %></p>
<% end %>
</ul>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/geo_data/_content.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<div class="tab-content" id="content">
<div class="description">
<% if geo_data.description.blank? %>
<%= t 'geo_data.description.empty', name: geo_data.name %>
<p class="empty"><%= t 'geo_data.description.empty', name: geo_data.name %></p>
<% else %>
<%= raw geo_data.description %>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/geo_data/_list_actions.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="list-actions">
<div class="list-actions" data-components="stick" data-stick-options='{ "get_width_from": ".site-page" }'>
<button class="select-all-btn" data-components='selectAll'>
<input type="checkbox" name="all" />Select All
</button>
Expand Down
2 changes: 1 addition & 1 deletion app/views/geo_data/_maps.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<% unless @maps.empty? %>
<%= render @maps, :size => :small %>
<% else %>
<p><%= t 'geo_data.maps.empty', {name: @geo_data.try(:name)} %></p>
<p class="empty"><%= t 'geo_data.maps.empty', {name: @geo_data.try(:name)} %></p>
<% end %>
</ul>
</div>
Expand Down
4 changes: 2 additions & 2 deletions app/views/maps/_content.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<div class="tab-content" id="content">
<div class="description">
<% if map.description.blank? %>
<%= t 'maps.description.empty', name: map.name %>
<p class="empty"><%= t 'maps.description.empty', name: map.name %></p>
<% else %>
<%= raw map.description %>
<% end %>
Expand All @@ -37,7 +37,7 @@
<% unless @geo_data_collection.empty? %>
<%= render @geo_data_collection, :size => :small %>
<% else %>
<p><%= t 'maps.data.empty', name: map.name %></p>
<p class="empty"><%= t 'maps.data.empty', name: map.name %></p>
<% end %>
</ul>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/maps/_geo_data.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<% unless @geo_data_collection.empty? %>
<%= render @geo_data_collection, :size => :small %>
<% else %>
<p><%= t 'maps.data.empty', {name: @map.try(:name)} %></p>
<p class="empty"><%= t 'maps.data.empty', {name: @map.try(:name)} %></p>
<% end %>
</ul>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/maps/_list_actions.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="list-actions">
<div class="list-actions" data-components="stick" data-stick-options='{ "get_width_from": ".site-page" }'>
<button class="select-all-btn" data-components='selectAll'>
<input type="checkbox" name="all" />Select All
</button>
Expand Down
2 changes: 1 addition & 1 deletion app/views/relations/_show.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="relations show">
<ul>
<% if relations.empty? %>
<div class="empty"><%= t('relations.empty') %></div>
<p class="empty"><%= t('relations.empty') %></p>
<% else %>
<% relations.each do |rel| %>
<%= render 'relations/relation', rel: rel %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/_contributions_list.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<% unless contributions.empty? %>
<%= render contributions, :size => :small %>
<% else %>
<p><%= t 'contributings.empty.contributions' %></p>
<p class="empty"><%= t 'contributings.empty.contributions' %></p>
<% end %>
</ul>
</div>
2 changes: 1 addition & 1 deletion app/views/users/_following_list.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<% unless following.empty? %>
<%= render following, :size => :small, :control_type => :follow_button %>
<% else %>
<p><%= t 'followings.empty.following', {name: user.name} %></p>
<p class="empty"><%= t 'followings.empty.following', {name: user.name} %></p>
<% end %>
</ul>
</div>
4 changes: 2 additions & 2 deletions spec/helpers/application_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@
end

describe "#follow_options_for" do
let(:user) { FactoryGirl.create :user, id: 42 }
let(:geo_data) { FactoryGirl.create :geo_data, id: 42 }
let(:user) { FactoryGirl.create :user}
let(:geo_data) { FactoryGirl.create :geo_data}

before { allow(helper).to receive(:current_user).and_return user }

Expand Down