pagination bootstrap update layout
This commit is contained in:
3
Gemfile
3
Gemfile
@@ -103,3 +103,6 @@ gem 'themes_for_rails'
|
|||||||
gem 'rubyzip'
|
gem 'rubyzip'
|
||||||
|
|
||||||
gem 'acts_as_votable'
|
gem 'acts_as_votable'
|
||||||
|
|
||||||
|
gem 'will_paginate'
|
||||||
|
gem 'bootstrap-will_paginate'
|
||||||
|
|||||||
10
app/assets/javascripts/pagination.js.coffee
Normal file
10
app/assets/javascripts/pagination.js.coffee
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
jQuery ->
|
||||||
|
if $('#infinite-scrolling').size() > 0
|
||||||
|
$(window).on 'scroll', ->
|
||||||
|
more_posts_url = $('.pagination .next_page a').attr('href')
|
||||||
|
b=$(document).height() - $(window).height() - 60
|
||||||
|
if more_posts_url && $(window).scrollTop() > b
|
||||||
|
$('.pagination').html('<b> Loading...</b>')
|
||||||
|
$.getScript more_posts_url
|
||||||
|
return
|
||||||
|
return
|
||||||
@@ -28,6 +28,7 @@ class HomeController < ApplicationController
|
|||||||
def linksnotimplemented
|
def linksnotimplemented
|
||||||
render 'links_notimplemented'
|
render 'links_notimplemented'
|
||||||
end
|
end
|
||||||
|
|
||||||
def search
|
def search
|
||||||
|
|
||||||
unless params['query'].nil? || params['query'].empty?
|
unless params['query'].nil? || params['query'].empty?
|
||||||
|
|||||||
@@ -86,6 +86,11 @@ class NeuigkeitenController < ApplicationController
|
|||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
def mail_preview
|
||||||
|
@neuigkeit = Neuigkeit.find(params[:id])
|
||||||
|
authorize! :publish, @neuigkeit
|
||||||
|
render template: "news_mailer/neuigkeit_mail", layout: false
|
||||||
|
end
|
||||||
def edit
|
def edit
|
||||||
@neuigkeit = Neuigkeit.find(params[:id])
|
@neuigkeit = Neuigkeit.find(params[:id])
|
||||||
|
|
||||||
@@ -109,8 +114,12 @@ class NeuigkeitenController < ApplicationController
|
|||||||
|
|
||||||
|
|
||||||
@nlink_search.flatten!
|
@nlink_search.flatten!
|
||||||
|
respond_to do |format|
|
||||||
|
format.html { render action:"show" }
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
render action:"show"
|
|
||||||
end
|
end
|
||||||
def create_link
|
def create_link
|
||||||
@neuigkeit = Neuigkeit.find(params[:id])
|
@neuigkeit = Neuigkeit.find(params[:id])
|
||||||
@@ -118,7 +127,7 @@ class NeuigkeitenController < ApplicationController
|
|||||||
Nlink.create(:link=>params[:link_type].constantize.find(params[:link_id]),:neuigkeit=>Neuigkeit.find(params[:id]))
|
Nlink.create(:link=>params[:link_type].constantize.find(params[:link_id]),:neuigkeit=>Neuigkeit.find(params[:id]))
|
||||||
@nlinks=@neuigkeit.nlinks
|
@nlinks=@neuigkeit.nlinks
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { edirect_to action:"show" }
|
format.html { redirect_to action:"show" }
|
||||||
format.js
|
format.js
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,13 +4,18 @@ class RubrikenController < ApplicationController
|
|||||||
def index
|
def index
|
||||||
if can?(:showintern, Rubrik)
|
if can?(:showintern, Rubrik)
|
||||||
@rubriken = Rubrik.all
|
@rubriken = Rubrik.all
|
||||||
@neuigkeiten = Neuigkeit.recent
|
@neuigkeiten = Neuigkeit.paginate(page: params[:page], per_page:3)
|
||||||
else
|
else
|
||||||
@rubriken = Rubrik.where(:public=>true)
|
@rubriken = Rubrik.where(:public=>true)
|
||||||
@neuigkeiten = Neuigkeit.public.recent
|
@neuigkeiten = Neuigkeit.public.recent
|
||||||
end
|
end
|
||||||
|
|
||||||
@calentries= @rubriken.collect(&:calentries).flatten
|
@calentries= @rubriken.collect(&:calentries).flatten
|
||||||
|
respond_to do |format|
|
||||||
|
format.html
|
||||||
|
format.js {render action: :show}
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
def intern
|
def intern
|
||||||
|
|
||||||
@@ -26,14 +31,17 @@ class RubrikenController < ApplicationController
|
|||||||
@moderatoren=User.with_role(:newsmoderator,@rubrik)
|
@moderatoren=User.with_role(:newsmoderator,@rubrik)
|
||||||
@calentries= @rubrik.calentries
|
@calentries= @rubrik.calentries
|
||||||
if can?(:showunpublished, Neuigkeit)
|
if can?(:showunpublished, Neuigkeit)
|
||||||
@neuigkeiten = @rubrik.neuigkeiten
|
@neuigkeiten = @rubrik.neuigkeiten.paginate(page: params[:page], per_page:3)
|
||||||
else
|
else
|
||||||
@neuigkeiten = @rubrik.neuigkeiten.published
|
@neuigkeiten = @rubrik.neuigkeiten.published.paginate(page: params[:page], per_page:3)
|
||||||
end
|
end
|
||||||
@toolbar_elements << {:text=>I18n.t('neuigkeit.new.title'), :path=> new_rubrik_neuigkeit_path(@rubrik),:hicon=>'icon-plus-sign'} if can? :verwalten, @rubrik
|
@toolbar_elements << {:text=>I18n.t('neuigkeit.new.title'), :path=> new_rubrik_neuigkeit_path(@rubrik),:hicon=>'icon-plus-sign'} if can? :verwalten, @rubrik
|
||||||
@toolbar_elements << {:text=>I18n.t('common.verwalten'), :path=>verwalten_rubrik_path(@rubrik),:icon=>:pencil} if can? :verwalten, @rubrik
|
@toolbar_elements << {:text=>I18n.t('common.verwalten'), :path=>verwalten_rubrik_path(@rubrik),:icon=>:pencil} if can? :verwalten, @rubrik
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -7,13 +7,13 @@
|
|||||||
<!--<link rel="shortcut icon" href="http://www.fet.at/favicon.ico">-->
|
<!--<link rel="shortcut icon" href="http://www.fet.at/favicon.ico">-->
|
||||||
<title>Fetsite</title>
|
<title>Fetsite</title>
|
||||||
|
|
||||||
|
|
||||||
<%= stylesheet_link_tag "themes/"+theme_name+"/application", :media => "all" unless theme_name.empty? %>
|
<%= stylesheet_link_tag "themes/"+theme_name+"/application", :media => "all" unless theme_name.empty? %>
|
||||||
<%= stylesheet_link_tag "application", :media=>"all" if theme_name.empty? %>
|
<%= stylesheet_link_tag "application", :media=>"all" if theme_name.empty? %>
|
||||||
<% theme_stylesheet_link_tag "test", :media => "all" %>
|
<% theme_stylesheet_link_tag "test", :media => "all" %>
|
||||||
<% theme_stylesheet_link_tag "mod", :media=>"all" %>
|
<% theme_stylesheet_link_tag "mod", :media=>"all" %>
|
||||||
<%= javascript_include_tag "application" %>
|
<%= javascript_include_tag "application" %>
|
||||||
<%= csrf_meta_tags %>
|
<%= csrf_meta_tags %>
|
||||||
|
<%= yield :header %>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@@ -27,7 +27,6 @@
|
|||||||
<%= link_to home_index_path do %>
|
<%= link_to home_index_path do %>
|
||||||
<span class="feticon-fet_logo fa-4x color-1"> </span>
|
<span class="feticon-fet_logo fa-4x color-1"> </span>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="menudiv" style="margin-top:12px">
|
<div id="menudiv" style="margin-top:12px">
|
||||||
|
|||||||
0
app/views/neuigkeiten/_find_link.js.erb
Normal file
0
app/views/neuigkeiten/_find_link.js.erb
Normal file
@@ -1,5 +1,20 @@
|
|||||||
|
<% if defined?(wrap_in) && !wrap_in.blank? %>
|
||||||
|
<%= content_tag wrap_in do %>
|
||||||
|
www
|
||||||
<% c =[:linkbox] %>
|
<% c =[:linkbox] %>
|
||||||
<% c << "color-"+neuigkeit.rubrik.color.to_s+"-dark" unless neuigkeit.rubrik.color.nil? %>
|
<% c << "color-"+neuigkeit.rubrik.color.to_s+"-dark" unless neuigkeit.rubrik.color.nil? %>
|
||||||
<%= link_to [neuigkeit.rubrik,neuigkeit], {class: c} do %>
|
<%= link_to [neuigkeit.rubrik,neuigkeit], {class: c} do %>
|
||||||
<%= render :partial=>"neuigkeiten/compact",:locals=> {:neuigkeit=> neuigkeit} %>
|
<%= render :partial=>"neuigkeiten/compact",:locals=> {:neuigkeit=> neuigkeit} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
|
||||||
|
<% c =[:linkbox] %>
|
||||||
|
<% c << "color-"+neuigkeit.rubrik.color.to_s+"-dark" unless neuigkeit.rubrik.color.nil? %>
|
||||||
|
<%= link_to [neuigkeit.rubrik,neuigkeit], {class: c} do %>
|
||||||
|
<%= render :partial=>"neuigkeiten/compact",:locals=> {:neuigkeit=> neuigkeit} %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<li>
|
|
||||||
<%= link_to nlink_list.link do %>
|
<%= link_to nlink_list.link do %>
|
||||||
<div class="contentbox" >
|
<div class="contentbox" style="height:9em">
|
||||||
<% p = nlink_list.link_type.downcase.pluralize+"/nlink" %>
|
<% p = nlink_list.link_type.downcase.pluralize+"/nlink" %>
|
||||||
<%= raw(strip_links(render :partial=>p, :object=>nlink_list.link )) %>
|
<%= raw(strip_links(render :partial=>p, :object=>nlink_list.link )) %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
5
app/views/neuigkeiten/_nlink_list_search_whole.html.erb
Normal file
5
app/views/neuigkeiten/_nlink_list_search_whole.html.erb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<div id="nlink_list_search">
|
||||||
|
<ul class="unstyled">
|
||||||
|
<%= render partial: "nlink_list_search", collection: nlink_list_search_whole %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
15
app/views/neuigkeiten/_nlink_list_whole.html.erb
Normal file
15
app/views/neuigkeiten/_nlink_list_whole.html.erb
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
<div id="nlink_list">
|
||||||
|
<%= I18n.t("neuigkeit.sieheauch") %>
|
||||||
|
<div class="container-fluid">
|
||||||
|
<% nlink_list_whole.each_slice(2) do |row| %>
|
||||||
|
<div class="row-fluid">
|
||||||
|
<% row.each do |nl| %>
|
||||||
|
<div class="span6">
|
||||||
|
<%= render partial: "nlink_list", object: nl %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
$('#nlink_list_search').html("");
|
$('#nlink_list_search').html("");
|
||||||
$('#nlink_list').html("<%= escape_javascript( render partial:"nlink_list", collection: @nlinks )%>");
|
$('#nlink_list').replaceWith("<%= escape_javascript( render partial:"nlink_list_whole", object: @nlinks )%>");
|
||||||
1
app/views/neuigkeiten/find_link.js.erb
Normal file
1
app/views/neuigkeiten/find_link.js.erb
Normal file
@@ -0,0 +1 @@
|
|||||||
|
$('#nlink_list_search').replaceWith("<%= escape_javascript( render partial:"nlink_list_search_whole", object: @nlink_search )%>");
|
||||||
@@ -27,18 +27,10 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<%= render 'layouts/pretty_toolbar', :object=> @toolbar_elements %>
|
<%= render 'layouts/pretty_toolbar', :object=> @toolbar_elements %>
|
||||||
</div>
|
</div>
|
||||||
|
<%= render partial: 'nlink_list_whole', :object=>@neuigkeit.nlinks %>
|
||||||
<%= I18n.t("neuigkeit.sieheauch") %>
|
<%= render partial: 'nlink_list_search_whole', object: @nlink_search %>
|
||||||
<ul class="unstyled">
|
|
||||||
<div id="nlink_list">
|
|
||||||
<%= render partial: "nlink_list", collection: @neuigkeit.nlinks %>
|
|
||||||
</div>
|
|
||||||
<div id="nlink_list_search">
|
|
||||||
<%= render partial: "nlink_list_search", collection: @nlink_search %>
|
|
||||||
</div>
|
|
||||||
</ul>
|
|
||||||
<% if can? :find_link, @neuigkeit %>
|
<% if can? :find_link, @neuigkeit %>
|
||||||
<%= semantic_form_for :find_link, :url=>find_link_rubrik_neuigkeit_path(@rubrik,@neuigkeit), :html=>{:id=>"search_form", :method=>'get'} do |f| %>
|
<%= semantic_form_for :find_link, :url=>find_link_rubrik_neuigkeit_path(@rubrik,@neuigkeit), :html=>{:id=>"search_form", :method=>'get'} , :remote=> true do |f| %>
|
||||||
<%= f.input :query, :input_html => { :name => 'query' },:label=>false %>
|
<%= f.input :query, :input_html => { :name => 'query' },:label=>false %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<h1>
|
<h1>
|
||||||
<%= @neuigkeit.title%>
|
<%= @neuigkeit.title%>
|
||||||
</h1>
|
</h1>
|
||||||
|
<%= image_tag @neuigkeit.picture.big_thumb.url %>
|
||||||
<%= raw(@neuigkeit.text) %>
|
<%= raw(@neuigkeit.text) %>
|
||||||
|
<p> Eine Nachricht aus deiner Fachschaft! wenn du diese Neuigkeiten nicht mehr bekommen willst hast du leider Pech gehabt es gibt keine Möglichkeit aus der FET wieder auszutreten.</p>
|
||||||
|
|||||||
@@ -12,12 +12,17 @@
|
|||||||
|
|
||||||
<div class="span9">
|
<div class="span9">
|
||||||
|
|
||||||
<ul class="unstyled linkbox-list" style="max-width:70em">
|
<ul class="unstyled linkbox-list" style="max-width:70em" id="neuigkeiten">
|
||||||
<% @neuigkeiten.each do |n| %>
|
<% @neuigkeiten.each do |n| %>
|
||||||
<li><%= render n if can?(:show, n) %> </li>
|
<li><%= render n if can?(:show, n) %> </li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
<div id="infinite-scrolling">
|
||||||
|
<%= will_paginate @neuigkeiten %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="span3">
|
<div class="span3">
|
||||||
<%= render 'calendars/calentries', :object=>@calentries %>
|
<%= render 'calendars/calentries', :object=>@calentries %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -19,16 +19,18 @@
|
|||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
|
|
||||||
<div class="span9">
|
<div class="span9">
|
||||||
<% @neuigkeiten.each_slice(1) do |row| %>
|
<ul class="unstyled linkbox-list" style="max-width:70em" id="neuigkeiten">
|
||||||
<ul class="unstyled" style="max-width:70em">
|
<% @neuigkeiten.each do |neuigkeit| %>
|
||||||
<% row.each do |neuigkeit| %>
|
|
||||||
<li>
|
<li>
|
||||||
<%= render neuigkeit %>
|
<%= render neuigkeit %>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
<% end %>
|
|
||||||
|
|
||||||
|
<div id="infinite-scrolling">
|
||||||
|
<%= will_paginate @neuigkeiten %>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="span3">
|
<div class="span3">
|
||||||
<%= render 'calendars/calentries', :object=>@calentries %>
|
<%= render 'calendars/calentries', :object=>@calentries %>
|
||||||
|
|||||||
7
app/views/rubriken/show.js.erb
Normal file
7
app/views/rubriken/show.js.erb
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
$('#neuigkeiten').append('<%= j render @neuigkeiten, :locals => { :wrap_in => :li} %>');
|
||||||
|
<% if @neuigkeiten.next_page %>
|
||||||
|
$('.pagination').replaceWith('<%= j will_paginate @neuigkeiten %>');
|
||||||
|
<% else %>
|
||||||
|
$(window).off('scroll');
|
||||||
|
$('.pagination').remove();
|
||||||
|
<% end %>
|
||||||
@@ -127,6 +127,7 @@ Fetsite::Application.routes.draw do
|
|||||||
get 'find_link'
|
get 'find_link'
|
||||||
get 'publish_to_facebook'
|
get 'publish_to_facebook'
|
||||||
get 'mail_to_fet'
|
get 'mail_to_fet'
|
||||||
|
get 'mail_preview'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user