diff --git a/README b/README index 38a27bc..5e9e0b1 100644 --- a/README +++ b/README @@ -1,4 +1,7 @@ Bernard Board - version 0.05 + +Opensource pluggable status board. + CHANGELOG 0.05 Pagination added to board screens CHANGELOG 0.04 Client and server side form validation. CHANGELOG 0.03 Complete reimplementation of plugins. diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 8c2e530..b40d509 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -1,6 +1,7 @@ class BoardsController < ApplicationController + def index - @boards = Board.paginate :page => params[:page], :order => 'created_at DESC' + @boards = Board.paginate :page => params[:page], :order => 'created_at DESC' respond_to do |format| format.html @@ -16,7 +17,6 @@ def index def show @board = Board.find(params[:id]) - redirect_to :controller => "griditems", :action => :index, :fullscreen => true, :load_board => @board.name end @@ -64,6 +64,7 @@ def update end def delete_board + Board.delete_all("name = '#{params[:name]}'") BoardItem.delete_all("board = '#{params[:name]}'") render :update do |page| diff --git a/app/controllers/gauge_controller.rb b/app/controllers/gauge_controller.rb new file mode 100644 index 0000000..99c87d6 --- /dev/null +++ b/app/controllers/gauge_controller.rb @@ -0,0 +1,29 @@ +class GaugeController < ApplicationController + def redraw_gauge + div = "" + value = "" + if params[:id] =~/item(\d+)/ + div = "con#{$1}" + end + + @parameters = {} + params[:parameters].split(";").each do |p| + tmp = p.split(/:/, 2) + @parameters[tmp[0]] = tmp[1] + end + + unless @parameters["remote"] == "true" + tmp = File.open(@parameters["path"], 'r') + value = tmp.gets() + else + Net::HTTP.start(@parameters["url"]) do |http| + resp = http.get("/#{@parameters["path"]}") + value = resp.body + end + end + + render :update do |page| + page << "redrawGauge(#{value}, '#{div}')" + end + end +end diff --git a/app/controllers/griditems_controller.rb b/app/controllers/griditems_controller.rb index b29bc07..8226ab0 100644 --- a/app/controllers/griditems_controller.rb +++ b/app/controllers/griditems_controller.rb @@ -5,6 +5,15 @@ class GriditemsController < ApplicationController rescue_action(exception.original_exception) end +#######TEMP TEST ACTION! GET RID OF IT BEFORE YOU COMMIT!!!!######## + def get_json + @values = ActiveSupport::JSON.encode [Time.now.to_i * 1000 ,rand(10)] + + respond_to do |format| + format.json {render :json => @values} + end + end + def index @fullscreen = params["fullscreen"] @load_board = params["load_board"] diff --git a/app/views/boards/_board_results.html.erb b/app/views/boards/_board_results.html.erb index 7803af0..2b11c60 100644 --- a/app/views/boards/_board_results.html.erb +++ b/app/views/boards/_board_results.html.erb @@ -12,15 +12,22 @@ <%=h board.name %> <%=h board.width %> <%=h board.height %> - <%= link_to 'Show', board %> - <%= link_to_remote "Delete Board", - :url => {:action => "delete_board"}, - :html => {:class => "board_item"}, - :with => "'name=' + '#{board.name}'" %> + <%= button_to 'Show', {:action => "show", :controller => "boards", :id => board.id, :method => "get"}, + {:class => "ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only", + :method => "get"} %> + <%= button_to_remote "Delete Board", + {:url => {:action => "delete_board", :id =>board.id}, :with => "'name=' + '#{board.name}'"}, + :class => "ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" + %> <% end %>
<%= will_paginate @boards %>
-
<%= link_to 'Edit and Create boards', :action => :index, :controller => :griditems %> +
+ <%= button_to 'Edit and Create boards', + {:action => :index, :controller => :griditems}, + {:class => "ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only", + :method => "get"} + %>
diff --git a/app/views/griditems/_item.html.erb b/app/views/griditems/_item.html.erb index 4a587cf..b4513e9 100644 --- a/app/views/griditems/_item.html.erb +++ b/app/views/griditems/_item.html.erb @@ -4,7 +4,7 @@ <%= @parameter_list = "" %> -
+
<%= render :partial => "griditems/plugins/#{@type.downcase}/#{@type.downcase}", :locals => {:parameters => @parameters, :itemid => "item" + @timestamp}%> <%= form_tag 'index' %> <% @parameters.each do |p| %> diff --git a/app/views/griditems/index.html.erb b/app/views/griditems/index.html.erb index cf5900b..3ff7a94 100644 --- a/app/views/griditems/index.html.erb +++ b/app/views/griditems/index.html.erb @@ -5,6 +5,7 @@ <% javascripts.each do |javascript| %> <%= javascript_include_tag "#{javascript}" %> <% end %> +<%= javascript_include_tag "js/highcharts.js" %> <% stylesheets = get_stylesheets %> <% stylesheets.each do |stylesheet| %> @@ -17,11 +18,8 @@
BernardBoard
-
-
- <% feed.items.each_with_index do |topic,i| %> -