PageRenderTime 19ms CodeModel.GetById 13ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/modules/mod_base/actions/action_base_alert.erl

http://github.com/zotonic/zotonic
Erlang | 42 lines | 17 code | 6 blank | 19 comment | 0 complexity | f1b55b9a5e5a36fd6fb9a2813e7f8d2c MD5 | raw file
 1%% @author Marc Worrell <marc@worrell.nl>
 2%% @copyright 2009 Marc Worrell
 3%%
 4%% Based on code copyright (c) 2008-2009 Rusty Klophaus
 5
 6%% Copyright 2009 Marc Worrell
 7%%
 8%% Licensed under the Apache License, Version 2.0 (the "License");
 9%% you may not use this file except in compliance with the License.
10%% You may obtain a copy of the License at
11%% 
12%%     http://www.apache.org/licenses/LICENSE-2.0
13%% 
14%% Unless required by applicable law or agreed to in writing, software
15%% distributed under the License is distributed on an "AS IS" BASIS,
16%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17%% See the License for the specific language governing permissions and
18%% limitations under the License.
19
20-module(action_base_alert).
21-include("zotonic.hrl").
22-export([
23    render_action/4,
24    event/2
25]).
26
27render_action(TriggerId, TargetId, Args, Context) -> 
28    {PostbackMsgJS, _PickledPostback} = z_render:make_postback({alert, Args}, click, TriggerId, TargetId, ?MODULE, Context),
29    {PostbackMsgJS, Context}.
30
31
32%% @doc Fill the dialog with the delete confirmation template. The next step will ask to delete the resource
33%% @spec event(Event, Context1) -> Context2
34event(#postback{message={alert, Args}}, Context) ->
35    Title = proplists:get_value(title, Args, ?__(<<"Alert">>, Context)),
36    Vars = [
37        {title, Title},
38        {action, proplists:get_all_values(action, Args)}
39        | Args
40    ],
41    z_render:dialog(Title, "_action_dialog_alert.tpl", Vars, Context).
42