Merge branch 'testgallery'

This commit is contained in:
Andreas Stephanides
2015-01-17 12:18:14 +01:00
21 changed files with 265 additions and 164 deletions

1
.gitignore vendored
View File

@@ -39,3 +39,4 @@ console
*#
Gemfile.lock
/config/database.yml
/config/start_topic.yml

View File

@@ -91,7 +91,7 @@ gem "simple_calendar", "~> 0.1.9"
gem 'rmagick'
gem 'bootstrap-addons-rails'
gem "jquery-fileupload-rails"
gem "jquery-fileupload-rails", "0.4.1"
gem "jquery-ui-rails","~> 4.1.1"
gem "font-awesome-rails"
gem "jquery-datetimepicker-rails"
@@ -115,4 +115,8 @@ gem 'sunspot_solr'
gem 'sitemap_generator'
gem 'whenever'
gem 'yaml_db'
gem 'etherpad-lite'
gem 'etherpad-lite'
# Image gallery
gem 'blueimp-gallery'
gem 'blueimp-gallery-rails'

View File

@@ -23,12 +23,11 @@
//= require bootstrap
//= require bootstrap/colorpicker
//= require bootstrap/datepicker
//= require bootstrap/load-image.min
//= require bootstrap/image-gallery.min
//= require jquery-fileupload
// require jquery.remotipart
//= require jquery.datetimepicker
function insertAttachment(url,name) {
var ext = url.split('.').pop().toLowerCase();
var img_ext = [ "jpg", "png", "bmp" , "jpeg" ];

View File

@@ -1,22 +1,21 @@
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*
*= require_self
* require_tree .
*= require 'calendars'
*= require jquery.fileupload-ui
* require 'bootstrap'
*= require 'tinymce'
*/
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*= require_self
* require_tree .
*= require 'calendars'
*= require jquery.fileupload-ui
* require 'bootstrap'
*= require 'tinymce'
*/
// Colorshema #0A64A4
$color_prim: #0A64A4;
$color_prim_light: #0B65A5;
@@ -45,34 +44,34 @@ $sansFontFamily: Helvetica, Arial;
@import 'font-awesome';
h1 {
font-size: 23px
font-size: 23px
}
h2 {
font-size: 19px
font-size: 19px
}
body,html {
padding:0;
margin:0;
padding:0;
margin:0;
}
a:hover {
text-decoration:none;
text-decoration:none;
}
div.header {
display: block;
// background: url('/header1.png') no-repeat;
background-color: #FFF;
background-position: right;
border-bottom:1px solid black;
height:41px;
color:#000;
padding-left:87px;
padding-top:0px;
overflow:hidden;
margin-bottom: 20px
display: block;
// background: url('/header1.png') no-repeat;
background-color: #FFF;
background-position: right;
border-bottom:1px solid black;
height:41px;
color:#000;
padding-left:87px;
padding-top:0px;
overflow:hidden;
margin-bottom: 20px
}
div.header h1 {
padding:0;
@@ -81,40 +80,40 @@ font-size:20px;
line-height:32px;
}
#menudiv {
width:100%;
width:100%;
}
.navbar .nav li {
min-width:100%;
min-width:100%;
}
.navbar .nav .divider {
border-style: solid;
border-width: 1px 0px 0px 0px;
border-color: grey;
min-width: 100%;
border-style: solid;
border-width: 1px 0px 0px 0px;
border-color: grey;
min-width: 100%;
}
.navbar .navbar-inner
{
border:none;
box-shadow:none;
border:none;
box-shadow:none;
}
#contentdiv
{
background: #FFFFFF
background: #FFFFFF
}
#contentdiv .container-fluid
{
padding:0;
padding:0;
}
a.linkbox, div.contentbox
{
display:block;
padding:5px;
border-radius: 10px;
border: lightgray solid 1px;
display:block;
padding:5px;
border-radius: 10px;
border: lightgray solid 1px;
}
@@ -132,16 +131,18 @@ margin-bottom:10px;
}
ul.linkbox-list
{
max-width:70em;
max-width:70em;
}
div.contentbox
{
margin: 5px;
margin: 5px;
}
.navbar .nav li {
min-width:100%;
background:44F;
}
}
@import 'galleries';

View File

@@ -2,39 +2,6 @@
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
//.modal.fade {
// top: -25%;
// transition: opacity 0.3s linear 0s, top 0.3s ease-out 0s;
//}
//.modal-gallery {
// max-height: none;
// outline: medium none;
// width: auto;
//}
//.modal {
// color: #333333;
//}
//.hide {
// display: none;
//}
//.modal {
//background-clip: padding-box;
// background-color: #FFFFFF;
// border: 1px solid rgba(0, 0, 0, 0.3);
//border-radius: 6px 6px 6px 6px;
// box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
// left: 50%;
// margin-left: -280px;
// outline: medium none;
// position: fixed;
// top: 10%;;
// z-index: 1050;
//}
//.fade {
// opacity: 0;
// transition: opacity 0.15s linear 0s;
//}
div.gallery-block
{
padding: 10px;

View File

@@ -1,3 +1,13 @@
@import 'blueimp-gallery-all';
.left
{
float: left;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
/* etc. */
}
h1 {
font-size: 23px
}

View File

@@ -11,11 +11,11 @@
*
*= require_self
* require_tree .
*= require blueimp-gallery-all
*= require jquery.fileupload-ui
*= require jquery.datetimepicker
*= require jquery.ui.dialog
* require 'bootstrap'
* require 'neuigkeiten'
*/

View File

@@ -87,10 +87,11 @@ class FotosController < ApplicationController
# DELETE /fotos/1.json
def destroy
@foto = Foto.find(params[:id])
gallery = @foto.gallery_id
@foto.destroy
respond_to do |format|
format.html { redirect_to galleries_url }
format.html { redirect_to gallery_path(gallery) }
format.json { head :no_content }
end
end

View File

@@ -18,23 +18,42 @@ class GalleriesController < ApplicationController
# GET /galleries/1.json
def show
@gallery = Gallery.find(params[:id])
@pppage_array = [ 25 , 50 , 100 ] #defines number & size of picture chunks
@pppage_array = [ 25 , 50 , 100, "all"] #defines number & size of picture chunks
@pppage = 0 #starting index of pppage_array
if params[:pppage].to_i <= 2 && params[:pppage].to_i >= 0
if !params[:pppage].nil? && params[:pppage].to_i <= 3 && params[:pppage].to_i >= 0
@pppage = params[:pppage].to_i
end
@page = params[:page].nil? ? 1 : params[:page].to_i
# @fotos = Foto.where(:gallery_id => params[:id]).limit(@pppage_array[@pppage]).offset(@pppage_array[@pppage]*(@page-1))
# @fotos = Foto.where(:gallery_id => params[:id]).limit(@pppage_array[@pppage]).offset(@pppage_array[@pppage]*(@page-1))
@fotos = Foto.where(:gallery_id => params[:id])
@pages = (Foto.where(:gallery_id => params[:id]).count/(@pppage_array[@pppage])+1)
@showind=[]
@showind.fill(0,@pppage_array[@pppage]){ |i| i+ @pppage_array[@pppage]*(@page-1)} # Hier ausrechnen welche angezeigt werden sollen
if @fotos.nil? || @fotos.empty?
@fotos_p = []
@fotos_n = []
@pages = 1
else
if @pppage_array[@pppage] != "all"
@fotos_p = @fotos.page(@page).per(@pppage_array[@pppage])
@fotos_n = @fotos- @fotos_p
@foto_ind = @fotos.find_index(@fotos_p.first)
@fotos_n = @fotos_n.rotate(@foto_ind)
@pages = (Foto.where(:gallery_id => params[:id]).count/(@pppage_array[@pppage])+1)
else
@fotos_p = @fotos
@fotos_n = []
@pages = 1
end
end
# Hier ausrechnen welche angezeigt werden sollen
@toolbar_elements << {:hicon=>'icon-plus', :text=> I18n.t('fotos.new-fotos'), :path=>new_gallery_foto_path(@gallery)}
@toolbar_elements << {:hicon=>'icon-pencil', :text => I18n.t('common.edit'), :path=>edit_gallery_path(@gallery)}
@toolbar_elements << {:hicon=>'icon-arrow-left', :text=>I18n.t('common.back'), :path=>galleries_path()}
@toolbar_elements << {:hicon => 'icon-remove-circle', :text => I18n.t('common.delete'), :path => gallery_path(@gallery),:confirm=>'Sure?', :method=>:delete} if can? :delete, Gallery
respond_to do |format|
format.html # show.html.erb
@@ -56,6 +75,7 @@ class GalleriesController < ApplicationController
# GET /galleries/1/edit
def edit
@gallery = Gallery.find(params[:id])
@fotos_old = @gallery.fotos
end
# POST /galleries
@@ -81,6 +101,10 @@ class GalleriesController < ApplicationController
@foto = Foto.new
respond_to do |format|
if @gallery.update_attributes(params[:gallery])
Foto.where(:gallery_id=>nil).each do |tbd|
tbd.destroy
end
format.html { redirect_to @gallery, notice: 'Gallery was successfully updated.' }
format.json { head :no_content }
else

View File

@@ -2,8 +2,12 @@ class HomeController < ApplicationController
def index
@beispiele = Beispiel.last([Beispiel.count, 3].min)
@neuigkeiten = Neuigkeit.recent
if Thema.count>0
t=YAML.load_file("#{::Rails.root.to_s}/config/start_topic.yml")
@starttopic= @themen = Thema.where(:id=>t).first
else
@starttopic=@themen = nil
end
end
def dev

View File

@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
class NeuigkeitenController < ApplicationController
before_filter :load_toolbar_elements, :only=>[:show,:find_link]
before_filter :load_toolbar_elements_edit, :only=>[:edit]

View File

@@ -12,8 +12,8 @@
class Gallery < ActiveRecord::Base
WORD_COUNT = 20
attr_accessible :datum, :desc, :name
has_many :fotos
attr_accessible :datum, :desc, :name, :foto_ids
has_many :fotos, :dependent => :destroy # Delete fotos if gallery is destroyed
has_many :nlinks, as: :link
# scope :search, ->(query) {where("name like ? or galleries.desc like ?", "%#{query}%", "%#{query}%")}
searchable do

View File

@@ -1,11 +1,20 @@
<%= semantic_form_for @gallery do |f| %>
<%= f.inputs do %>
<%= f.input :name %>
<%= f.input :desc %>
<%= f.input :datum %>
<% end %>
<div class="container-fluid">
<div class="fluid-row">
<div class="span4">
<%= semantic_form_for @gallery do |f| %>
<%= f.inputs do %>
<%= f.input :name %>
<%= f.input :desc %>
<%= f.input :datum %>
<% end %>
<%= f.actions do %>
<%= f.action :submit, :as => :input %>
<% end %>
<% end %>
<%= f.actions do %>
<%= f.action :submit, :as => :input %>
<% end %>
<% end %>
</div>
</div>
</div>

View File

@@ -36,48 +36,81 @@
</div>
</div>
</div>
<div style="clear:both"></div>
<div class="fluid-row" style="margin:20px">
<!-- modal-gallery is the modal dialog used for the image gallery -->
<div id="modal-gallery" class="modal hide fade modal-gallery modal-fullscreen modal-loading" tabindex="-1">
<div class="modal-header">
<a class="close" data-dismiss="modal">&times;</a>
<h3 class="modal-title"></h3>
</div>
<div class="modal-body"><div class="modal-image"></div></div>
<div class="modal-footer">
<a class="btn btn-info modal-prev"><i class="icon-arrow-left icon-white"></i></a>
<a class="btn btn-primary modal-next"><i class="icon-arrow-right icon-white"></i></a>
<a class="btn btn-success modal-play modal-slideshow" data-slideshow="5000"><i class="icon-play icon-white"></i> <%=I18n.t('fotos.slideshow')%></a>
<a class="btn modal-download" target="_blank"><i class="icon-download"></i> Download</a>
<!-- The Bootstrap Image Gallery lightbox, should be a child element of the document body -->
<div id="blueimp-gallery" class="blueimp-gallery blueimp-gallery-controls">
<!-- The container for the modal slides -->
<div class="slides"></div>
<!-- Controls for the borderless lightbox -->
<h3 class="title"></h3>
<a class="prev"></a>
<a class="next"></a>
<a class="close">×</a>
<a class="play-pause"></a>
<ol class="indicator"></ol>
<!-- The modal dialog, which will be used to wrap the lightbox content -->
<div class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" aria-hidden="true">&times;</button>
<h4 class="modal-title"></h4>
</div>
<div class="modal-body next"></div>
<div class="modal-footer">
<button type="button" class="btn btn-default pull-left prev">
<i class="glyphicon glyphicon-chevron-left"></i>
Previous
</button>
<button type="button" class="btn btn-primary next">
Next
<i class="glyphicon glyphicon-chevron-right"></i>
</button>
</div>
</div>
</div>
</div>
<div id="gallery" data-toggle="modal-gallery" data-target="#modal-gallery">
<% @fotos.each_index do |i| %>
<% f= @fotos[i] %>
<a href="<%= f.datei.resized.url%>" title="<%=f.title%>" data-gallery="gallery">
<%=image_tag(f.datei.thumb.url,{:class=>"img-polaroid img-rounded"}) if @showind.include? i %></a>
</div>
<p></p>
<div class="row-fluid">
<div class="span12">
<% @fotos_p.each do |f| %>
<div class="left">
<div id="links">
<a href="<%= f.datei.resized.url%>" title="<%=f.title%>" data-gallery>
<%=image_tag(f.datei.thumb.url,{:class=>"img-polaroid img-rounded"}) %></a>
</div>
<%= link_to ff_icon('icon-circle-arrow-down').html_safe, f.datei.url,
:class=>"btn-small",title: I18n.t('fotos.download')+': '+f.title, rel: 'tooltip' %>
<%= link_to ff_icon('icon-remove-circle').html_safe, gallery_foto_path(@gallery, f),
:method => :delete, :class=>"btn-small btn-danger",title: I18n.t('fotos.delete')+': '+f.title, rel: 'tooltip', confirm: I18n.t('fotos.delete')+': '+f.title+', Sicher?'%>
<p></p>
</div>
<% end %>
<% @fotos_n.each do |f| %>
<div id="links">
<a href="<%= f.datei.resized.url%>" title="<%=f.title%>" data-gallery></a>
<% end %>
</div>
</div>
</div>
<%= render 'layouts/pretty_toolbar' %>
<div class="row-fluid">
<% if can? :delete,@gallery %>
<div class="span12">
<%= link_to ff_icon('icon-circle-arrow-down').html_safe, '',
:class=>"btn-small"%>: <%= I18n.t('fotos.download_long')%><br>
<%= link_to ff_icon('icon-remove-circle').html_safe, '',
:class=>"btn-small btn-danger"%>: <%= I18n.t('fotos.delete')%>
<p></p>
</div>
<% end %>
<%= render 'layouts/pretty_toolbar' %>
</div>
<%= @pppage_array[@pppage] %>
<%= javascript_include_tag "blueimp-gallery-all" %>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script src="js/bootstrap.js"></script>
<script src="js/load-image.js"></script>
<script src="js/bootstrap-image-gallery.js"></script>
<script type="text/javascript">
$('#modal-gallery.fade').css('top', '50%');
</script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="//blueimp.github.io/Gallery/js/jquery.blueimp-gallery.min.js"></script>
<script src="js/bootstrap-image-gallery.min.js"></script>

View File

@@ -43,4 +43,6 @@ de:
adresse: "Adresse"
adresse_text: "Gußhausstraße 25-27<br>1220 Wien"
service_text: "Für individuelle Beratung und alle sonstigen Angelegenheiten stehen wir mit unserem Servicedienst während der Vorlesungszeit jenen <b>Mo-Fr von 9 bis 15 Uhr</b> zur Verfügung. Außerhalb dieser Zeiten ist oft trotzdem jemand auf der Fachschaft der dir weiterhelfen kann."
telefon_text: "Telefon: +43 2241341 <br> Skype: <br><b>E-Mail: service@fet.at</b>"
telefon_text: "Telefon: +43 2241341 <br> Skype: <br><b>E-Mail: service@fet.at</b>"
search:
no_results_for: "Es wurden keine Einträge gefunden für"

View File

@@ -1,5 +1,8 @@
de:
fotos:
delete: "Foto löschen"
download: "Link zu Originaldatei"
download_long: "Link zu Originaldatei. Für Download Rechtsklick->speichern unter."
galleries: "Bildergalerien"
new-gallery: "Neue Galerie"
new-fotos: "Fotos hinzufügen"

View File

@@ -1,7 +1,5 @@
Fetsite::Application.routes.draw do
Fetsite::Application.routes.draw do
themes_for_rails
devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
resources :home, :only=>[:index] do

View File

@@ -1,10 +1,9 @@
production:
solr:
hostname: localhost
port: 8080
port: 8983
log_level: WARNING
path: /solr-4.10.2/default #production #ollection1 #production
# solr_home: solr
path: /solr/production
# read_timeout: 2
# open_timeout: 0.5
@@ -21,4 +20,4 @@ test:
port: 8981
log_level: WARNING
path: /solr/test

51
initscript.sh Executable file
View File

@@ -0,0 +1,51 @@
#! /bin/bash
ruby_command="ruby"
rake_command="rake"
bundler_command="bundler"
# Are the necessary programs installed?
command -v $ruby_command >/dev/null 2>&1 || { echo >&2 "The given ruby command does not exist. Please change the command or install ruby"; exit 1; }
command -v $rake_command >/dev/null 2>&1 || { echo >&2 "The given rake command does not exist. Please change the command or install ruby"; exit 1; }
command -v $bundler_command >/dev/null 2>&1 || { echo >&2 "The given bundler command does not exist. Please change the command or install ruby"; exit 1; }
echo "All necessary programs exist"
echo "Generating base configs..."
# Generate clean config files if they don't exist
cp -u config/database.yml.example config/database.yml
cp -u config/omniauth_secrets.yml.example config/omniauth_secrets.yml
echo "Bundle install..."
# Run Bundler
$bundler_command install || {echo "Bundler failed. Please run \"$bundle\_command install\" seperately and debug the errors, before running this script again";exit 1;}
echo "Migrate the database..."
# Run the migration
$rake_command db:migrate ||{echo "Migration failed. Please run \"$rake\_command db:migrate\" seperately and debug the errors, before running this script again"; exit 1;}
echo "Start the sunspot server"
# Run Sunspot
$rake_command sunspot:solr:stop &> /dev/null
$rake_command sunspot:solr:start || exit 1
# Topic 1 is supposed to be the startpage topic
if [ ! -f config/start_topic.yml ]; then
echo "generate new start_topic with topic id 1"
echo "1" > config/start_topic.yml
fi
# Generate fetadmin user "admin@fet.at", password: 12345678
echo "The homepage is ready to use."
echo "A dummy admin user has been created. The credentials are:"
echo ""
echo " email: admin@fet.at"
echo " password: 12345678"
echo ""
echo "Please delete this user after a proper setup"
echo ""
echo "The Rails server is started with the command \"rails server\""
echo "The Rails console is started with the command \"rails console\""

View File

@@ -60,17 +60,11 @@
<fieldType name="rand" class="solr.RandomSortField" omitNorms="true"/>
<!-- *** This fieldType is used by Sunspot! *** -->
<fieldType name="text" class="solr.TextField" omitNorms="false">
<analyzer type="index">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StandardFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.NGramFilterFactory" minGramSize="2" maxGramSize="30"/>
<filter class="solr.TrimFilterFactory" />
<filter class="solr.EdgeNGramFilterFactory" minGramSize="2" maxGramSize="30"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.TrimFilterFactory" />
<filter class="solr.PorterStemFilterFactory"/>
</analyzer>
</fieldType>
<!-- *** This fieldType is used by Sunspot! *** -->