OpenIrekia v4.0.0
Copyright 2009-2013 eFaber, S.L. Copyright 2009-2013 Ejie, S.A. Copyrigth 2009-2013 Dirección de Gobierno Abierto y Comunicación en Internet;
Gobernu Irekirako eta Interneteko Komunikaziorako Zuzendaritza; Lehendakaritza. Gobierno Vasco – Eusko Jaurlaritza
Licencia con arreglo a la EUPL, Versión 1.1 o –en cuanto sean aprobadas por la Comisión Europea– versiones posteriores de la EUPL (la Licencia); Solo podrá usarse esta obra si se respeta la Licencia. Puede obtenerse una copia de la Licencia en: ec.europa.eu/idabc/eupl Salvo cuando lo exija la legislación aplicable o se acuerde por escrito, el programa distribuido con arreglo a la Licencia se distribuye TAL CUAL, SIN GARANTÍAS NI CONDICIONES DE NINGÚN TIPO, ni expresas ni implícitas. Véase la Licencia en el idioma concreto que rige los permisos y limitaciones que establece la Licencia
http://open.irekia.net, openirekia@efaber.net
# File app/controllers/mob_app_controller.rb, line 210 def about @pages = [Page.legal_iphone, Page.prop_int_iphone, Page.about].compact render :action => "about.json" end
# File app/controllers/mob_app_controller.rb, line 205 def appdata @v = params[:v] || params[:version] render :action => "appdata.#{@v}.json" end
# File app/controllers/mob_app_controller.rb, line 165 def area @area = Area.find(params[:area_id]) if logged_in? && current_user.follows?(@area) @following = current_user.followings.find_by_followed_id(@area.id) end render :action => "area.json" end
# File app/controllers/mob_app_controller.rb, line 160 def areas get_areas render :action => "areas.json" end
HQ def questions
if params[:area_id] @area = Area.find(params[:area_id]) @questions = @area.approved_and_published_questions.find :all, :order => "contributions.published_at DESC", :limit => 15 else @questions = Question.approved.published.find :all, :order => "contributions.published_at DESC", :limit => 15 end render :action => "questions.json"
end
# File app/controllers/mob_app_controller.rb, line 240 def argazki extra = "" if params[:o].present? extra="&o=#{params[:o]}" end begin uri=(URI.parse("#{ARGAZKI_URI}/api/photos?batch=42&size=m&more_info=true#{extra}")) Net::HTTP.start(uri.host, uri.port) do |http| headers = { 'Content-Type' => 'application/json'} response = http.send_request("GET", uri.request_uri, "", headers) logger.info "Argazki API Response: #{response.code} #{response.message}" @code=response.code @body=response.body end rescue => e logger.info "There were some problems connecting to Argazki #{ARGAZKI_URI}. Please try later." end @photos=[] if @code.eql?('200') items = JSON.parse(@body) if items["status"].eql?(200) @photos = items["items"] else @error = true end end respond_to do |format| format.json {render :action => "argazki.json"} format.floki do if ipad_app_request? || iphone4_app_request? # aumentar la calidad de las imagenes render :action => "argazki_ipad.json" else render :action => "argazki.json" end end end end
# File app/controllers/mob_app_controller.rb, line 43 def events if params[:area_id] @area = Area.find(params[:area_id]) @events = @area.events.find(:all, :conditions => ["starts_at >= ? OR ends_at > ?", Date.today, Date.today], :limit => 15) else @events = Event.published.translated.future(Time.zone.now - 1.day).find :all, :limit => 15 end # # 50 viejas # events = Event.published.translated.find(:all, :conditions => "starts_at BETWEEN '#{Time.now - 3.months}' and '#{Time.now - 2.months}'") # @events = events.map {|e| e if e.show_in.eql?('actos')}.compact[0..50] # # 20 nuevas # events = Event.published.translated.find(:all, :conditions => "starts_at BETWEEN '#{Time.now - 2.months}' and '#{Time.now - 0.months}'") # @events = events.map {|e| e if e.show_in.eql?('actos')}.compact[0..20] # :limit => 15 render :action => "events.json" end
# File app/controllers/mob_app_controller.rb, line 24 def news conditions = [] if params[:o].present? last = News.find(params[:o]) conditions = ["published_at < ?", last.published_at] end if params[:area_id].present? @area = Area.find(params[:area_id]) @news = @area.news.find(:all, :order => 'published_at DESC', :limit => 15, :conditions => conditions) else @news = News.published.translated.listable.find :all, :conditions => conditions, :limit => 15, :order => 'published_at DESC' end render :action => "news.json" # render :json => @documents end
# File app/controllers/mob_app_controller.rb, line 98 def photos conditions = [] if params[:o].present? last = Photo.find(params[:o]) conditions = ["photos.created_at <= ? AND photos.id < ?", last.created_at, last.id] end if params[:news_id].present? @document = News.find(params[:news_id]) @photos = @document.album.photos if @document.album.present? elsif params[:area_id].present? @area = Area.find(params[:area_id]) @photos = @area.photos.find(:all, :limit => 48, :conditions => conditions, :order => 'created_at DESC') else @photos = Photo.published.find(:all, :conditions => conditions, :limit => 48, :order => "created_at DESC, id DESC") end respond_to do |format| format.json {render :action => "photos.json"} format.floki do if ipad_app_request? render :action => "photos_ipad.json" elsif iphone4_app_request? render :action => "photos_ipad.json" else render :action => "photos.json" end end end end
# File app/controllers/mob_app_controller.rb, line 173 def politician @politician = Politician.find(params[:person_id]) if logged_in? && current_user.follows?(@politician) @following = current_user.followings.find_by_followed_id(@politician.id) end render :action => "politician.json" end
# File app/controllers/mob_app_controller.rb, line 215 def proposals if params[:area_id] @area = Area.find(params[:area_id]) @proposals = @area.approved_and_published_proposals.find :all, :order => "contributions.published_at DESC", :limit => 15 else @proposals = Proposal.approved.published.find :all, :order => "contributions.published_at DESC", :limit => 15 end render :action => "proposals.json" end
# File app/controllers/mob_app_controller.rb, line 196 def root # HQ # @all_questions = Question.approved.published.count # @all_questions_answered = Question.approved.answered.count @all_proposals_citiz = Proposal.approved.published.count @all_proposals_gov = Debate.published.count render :action => "root.json" end
# File app/controllers/mob_app_controller.rb, line 61 def search if params[:page] && params[:page].to_i > 0 @page=params[:page].to_i @from=(params[:page].to_i-1)*Elasticsearch::ITEMS_PER_PAGE else @page=1 @from=0 end if params[:type].present? @type = params[:type] else @type = 'news' end @q = params[:q] criterio = Criterio.create(:title => "keyword: #{@q}", :ip => request.remote_ip, :iphone => true) if @page == 1 if @q.present? all_results=Elasticsearch::do_elasticsearch_for_ios(@q, @type, @from) @results = [] @results = all_results['hits'] if all_results.present? render :action => "search.json" else redirect_to news_mob_app_url end end
# File app/controllers/mob_app_controller.rb, line 187 def show @v = params[:v] || params[:version] render :action => "show.json" end
# File app/controllers/mob_app_controller.rb, line 181 def team @area = Area.find(params[:area_id]) @team = @area.users.approved render :action => 'team.json' end
# File app/controllers/mob_app_controller.rb, line 192 def v3 render :action => "v3.json" end
# File app/controllers/mob_app_controller.rb, line 129 def videos conditions = [] if params[:o].present? last = Video.find(params[:o]) conditions = ["videos.published_at <= ? AND videos.id < ?", last.published_at, last.id] end if params[:news_id].present? @document = News.find(params[:news_id]) @videos = @document.webtv_videos.published elsif params[:area_id].present? @area = Area.find(params[:area_id]) @videos = @area.videos.find(:all, :conditions => conditions, :order => 'published_at DESC', :limit => 15) else @videos = Video.published.translated.find :all, :conditions => conditions, :limit => 15, :order => "published_at DESC, id DESC" end respond_to do |format| format.json {render :action => "videos.json"} format.floki do if ipad_app_request? render :action => "videos_ipad.json" # elsif iphone4_app_request? # render :action => "videos_ipad.json" else render :action => "videos.json" end end end end