Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Full fixes from VK

  • Loading branch information...
commit 2ba6eb0fba1bb30ca77346abdbbf605f2dc54f5e 1 parent 9af8732
Evan Miller authored
View
2  priv/chicagoboss_admin.routes → priv/cb_admin.routes
@@ -1,7 +1,7 @@
%% The {Controller, Action} pair to be used on the home page. Defaults to {"hello", "world"}
%% Format: {"Controller", "Action"}
-{"/", {"admin", "splash"}}.
+{"/", {"admin", "index"}}.
%%
%% The action to call if none is specified. Defaults to "index"
View
32 src/controller/cb_admin_admin_controller.erl
@@ -0,0 +1,32 @@
+-module(cb_admin_admin_controller, [Req, SessionID]).
+-compile(export_all).
+-default_action(index).
+
+before_("splash") ->
+ ok;
+before_("access_denied") ->
+ ok;
+before_(_) ->
+ cb_admin_lib:require_ip_address(Req).
+
+index('GET', [], Authorization) ->
+ [{loaded, ModulesLoaded}, _, _, _, _, _] = application:info(),
+ ConfigValues = [ [{Key, Value}] || {Key, Value} <- application:get_all_env()],
+ SystemValues = [ {otp_release, erlang:system_info(system_version)},
+ {processors, erlang:system_info(logical_processors_online)},
+ {uptime, cb_admin_lib:uptime()},
+ {node, erlang:node()}
+ ],
+ {ok, [ {index_section, true}, {modules_loaded, ModulesLoaded},
+ {config_env, ConfigValues}, {system_env, SystemValues},
+ {nodes, erlang:nodes()}] }.
+
+news_api('POST', ["created", Id], Auth) ->
+ ok = boss_news:created(Id, Req:post_params("new")),
+ {output, "ok"};
+news_api('POST', ["updated", Id], Auth) ->
+ ok = boss_news:updated(Id, Req:post_params("old"), Req:post_params("new")),
+ {output, "ok"};
+news_api('POST', ["deleted", Id], Auth) ->
+ ok = boss_news:deleted(Id, Req:post_params("old")),
+ {output, "ok"}.
Please sign in to comment.
Something went wrong with that request. Please try again.