diff options
author | Jochen Topf <jochen@topf.org> | 2014-09-06 20:37:13 +0200 |
---|---|---|
committer | Jochen Topf <jochen@topf.org> | 2014-09-06 20:37:13 +0200 |
commit | a841bf2f35bfe477db2458533b8a875cd9cf38e8 (patch) | |
tree | 2ab19aef5c06c65f09d7d5e7406918d6ffc30b9b /web/lib/ui | |
parent | 95ff801f4829046ca44f949beddb56b066768466 (diff) | |
download | taginfo-a841bf2f35bfe477db2458533b8a875cd9cf38e8.tar taginfo-a841bf2f35bfe477db2458533b8a875cd9cf38e8.tar.gz |
Refactor projects code to work without the Project class.
This way we always get the data dynamically from the database instead of
loading it once at program start. This could allow faster updates in the
future.
Diffstat (limited to 'web/lib/ui')
-rw-r--r-- | web/lib/ui/projects.rb | 9 | ||||
-rw-r--r-- | web/lib/ui/taginfo.rb | 3 |
2 files changed, 9 insertions, 3 deletions
diff --git a/web/lib/ui/projects.rb b/web/lib/ui/projects.rb index b2eec53..b79bbde 100644 --- a/web/lib/ui/projects.rb +++ b/web/lib/ui/projects.rb @@ -15,12 +15,15 @@ class Taginfo < Sinatra::Base @project_id = params[:project] end - @project = Project.get(@project_id) + @project = @db.select("SELECT * FROM projects.projects"). + condition("id = ?", @project_id).execute()[0] - if @project - @title = [h(@project.name), t.taginfo.projects] + if !@project + halt 404 end + @title = [h(@project['name']), t.taginfo.projects] + section :projects javascript_for(:flexigrid) diff --git a/web/lib/ui/taginfo.rb b/web/lib/ui/taginfo.rb index 710f48f..2f7451b 100644 --- a/web/lib/ui/taginfo.rb +++ b/web/lib/ui/taginfo.rb @@ -110,6 +110,9 @@ class Taginfo < Sinatra::Base @title = t.taginfo.projects @section = 'taginfo' @section_title = t.taginfo.meta + + @projects = @db.select("SELECT * FROM projects.projects ORDER BY name").execute(); + erb :'taginfo/projects' end |