diff --git a/app/controllers/curator/locations_controller.rb b/app/controllers/curator/locations_controller.rb index bd79b384..f70911c9 100644 --- a/app/controllers/curator/locations_controller.rb +++ b/app/controllers/curator/locations_controller.rb @@ -45,7 +45,14 @@ def needs_photos @locations = @locations.having("COUNT(active_storage_attachments.id) <= ?", params[:max_photos].to_i) end - @locations = @locations.page(params[:page]).per(30) + page = params[:items_page] || params[:page] || 1 + @locations = @locations.page(page).per(12) + + # Handle partial loading for load-more + if params[:partial] == "items" && request.xhr? + return render partial: "curator/locations/needs_photo_items", locals: { locations: @locations }, layout: false + end + @city_names = Location.where.not(city: [ nil, "" ]).distinct.pluck(:city).sort end diff --git a/app/views/curator/dashboard/index.html.erb b/app/views/curator/dashboard/index.html.erb index b775a09b..dcd25062 100644 --- a/app/views/curator/dashboard/index.html.erb +++ b/app/views/curator/dashboard/index.html.erb @@ -21,25 +21,8 @@ - -
-
-
<%= t("curator.dashboard.total_reviews") %>
-
<%= @stats[:reviews_count] %>
-
- - - - - <%= @stats[:average_rating] %> <%= t("curator.dashboard.avg") %> - -
-
-
-
<%= t("curator.dashboard.recent_reviews") %>
-
<%= @stats[:pending_reviews] %>
-
<%= t("curator.dashboard.last_7_days") %>
-
+ +
<%= t("curator.dashboard.audio_tours") %>
<%= @stats[:audio_tours_with_audio] %>/<%= @stats[:audio_tours_count] %>
@@ -175,45 +158,6 @@
- -
-
-
-

<%= t("curator.dashboard.recent_reviews_title") %>

- <%= link_to curator_reviews_path, class: "text-sm text-emerald-600 dark:text-emerald-400 hover:text-emerald-900 dark:hover:text-emerald-300" do %> - <%= t("common.view_all") %> - <% end %> -
-
    - <% @stats[:recent_reviews].each do |review| %> -
  • - <%= link_to curator_review_path(review), class: "block hover:bg-gray-50 dark:hover:bg-gray-700 -mx-2 px-2 py-1 rounded-md" do %> -
    -
    -
    - <% review.rating.times do %> - - - - <% end %> - <%= review.reviewable_type %> -
    -
    <%= review.comment.presence&.truncate(50) || t("curator.reviews.no_comment") %>
    -
    - - - -
    - <% end %> -
  • - <% end %> - <% if @stats[:recent_reviews].empty? %> -
  • <%= t("curator.dashboard.no_reviews") %>
  • - <% end %> -
-
-
-
diff --git a/app/views/curator/locations/_needs_photo_item.html.erb b/app/views/curator/locations/_needs_photo_item.html.erb new file mode 100644 index 00000000..60421aa1 --- /dev/null +++ b/app/views/curator/locations/_needs_photo_item.html.erb @@ -0,0 +1,18 @@ +
+
+ <%= link_to location.name, curator_location_path(location), + class: "font-medium text-gray-900 dark:text-white hover:text-emerald-600 dark:hover:text-emerald-400 truncate block" %> +

<%= location.city %>

+
+ + <% photos_count = location.photos_count.to_i %> + + <%= photos_count %> + + + <%= link_to new_curator_location_photo_suggestion_path(location), + class: "flex-shrink-0 rounded-md bg-emerald-600 px-3 py-1.5 text-xs font-medium text-white hover:bg-emerald-500" do %> + + <%= t("curator.locations.needs_photos.add_photo") %> + <% end %> +
diff --git a/app/views/curator/locations/_needs_photo_items.html.erb b/app/views/curator/locations/_needs_photo_items.html.erb new file mode 100644 index 00000000..c57847e9 --- /dev/null +++ b/app/views/curator/locations/_needs_photo_items.html.erb @@ -0,0 +1,3 @@ +<% locations.each do |location| %> + <%= render "curator/locations/needs_photo_item", location: location %> +<% end %> diff --git a/app/views/curator/locations/needs_photos.html.erb b/app/views/curator/locations/needs_photos.html.erb index fa2201d1..f8f40195 100644 --- a/app/views/curator/locations/needs_photos.html.erb +++ b/app/views/curator/locations/needs_photos.html.erb @@ -32,68 +32,32 @@ <%# Results %> <% if @locations.any? %> -
- - - - - - - - - - - <% @locations.each do |location| %> - - - - - - - <% end %> - -
- <%= t("curator.locations.name") %> - - <%= t("curator.locations.city") %> - - <%= t("curator.locations.needs_photos.photo_count") %> - - <%= t("common.actions") %> -
-
- <% if location.photos.attached? && location.photos.first.present? %> - <%= image_tag rails_blob_path(location.photos.first.variant(:thumb), disposition: "inline"), - class: "h-10 w-10 rounded-lg object-cover flex-shrink-0" %> - <% else %> -
- - - -
- <% end %> -
- <%= link_to location.name, curator_location_path(location), - class: "text-sm font-medium text-gray-900 dark:text-white hover:text-emerald-600 dark:hover:text-emerald-400 truncate block" %> -
-
-
- <%= location.city %> - - <% photos_count = location.photos_count.to_i %> - - <%= photos_count %> <%= t("curator.locations.needs_photos.photos") %> - - - <%= link_to t("curator.locations.needs_photos.add_photo"), - new_curator_location_photo_suggestion_path(location), - class: "text-emerald-600 dark:text-emerald-400 hover:text-emerald-800 dark:hover:text-emerald-300 font-medium" %> -
-
+
+ +
+ <%= render "curator/locations/needs_photo_items", locations: @locations %> +
-
- <%= paginate @locations %> + <%# Load More %> +
+ + +
<% else %>