Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ui: published above flattrdropdown

  • Loading branch information...
commit 03975b2dc5a2d8466a8940ac3679dfb76867aced 1 parent 93ebba3
@astro authored
View
2  apps/ui/priv/static/flattrdropdown.js
@@ -23,7 +23,7 @@ function setupButton(buttonEl) {
div = document.createElement('div');
div.innerHTML = buttonEl.getAttribute('data-payment');
- buttonEl.parentNode.insertBefore(div, buttonEl.nextSibling.nextSibling);
+ buttonEl.parentNode.parentNode.appendChild(div);
buttonEl.textContent = "Flattr ▴";
FlattrLoader.setup();
View
8 apps/ui/priv/static/style.css
@@ -124,9 +124,6 @@ h3.feed {
display: inline;
}
.published {
- float: right;
- display: inline;
- text-align: right;
margin: 0 0 0.1em 0.5em;
padding: 0 2px;
font-size: 50%;
@@ -159,12 +156,15 @@ img.logo {
text-align: right;
margin: 1em 0 0;
}
+.right {
+ float: right;
+ text-align: right;
+}
.flattrdropdown.shown {
display: block;
}
.flattrdropdown {
display: none;
- float: right;
text-align: right;
font-size: 80%;
margin-left: 0.2em;
View
140 apps/ui/src/ui_template.erl
@@ -141,75 +141,8 @@ render_item(Opts, #feed_item{user = User,
true ->
[]
end,
- if
- Opts#render_opts.flattr ->
- PaymentData1 =
- if
- is_binary(Payment),
- size(Payment) > 0 ->
- [{dl, [{class, <<"flattr">>}],
- [{dt, [<<"Support ">>, User]},
- {dd,
- case Payment of
- %% Transform an autosubmit link to Flattr button
- <<"https://flattr.com/submit/auto?",
- Payment1/binary>> ->
- {a, [{class, <<"FlattrButton">>},
- {href, Payment}
- | [case K of
- <<"user_id">> ->
- {"data-flattr-uid", V};
- _ ->
- {"data-flattr-" ++ binary_to_list(K), V}
- end
- || {K, V} <- cowboy_http:x_www_form_urlencoded(
- Payment1, fun cowboy_http:urldecode/1)
- ]],
- <<"Support the publisher">>};
- _ ->
- {a, [{href, Payment}],
- Payment}
- end}
- ]}];
- true ->
- []
- end,
- PaymentData2 =
- [{dl, [{class, <<"flattr">>}],
- [{dt, <<"Support bitlove.org">>},
- {dd,
- {a, [{class, <<"FlattrButton">>},
- {href, <<"https://flattr.com/profile/Astro">>},
- {'data-flattr-url', <<(ui_link:base())/binary,
- ItemLink/binary>>},
- {'data-flattr-uid', <<"Astro">>},
- {'data-flattr-title', <<"Torrent for ", Title/binary, " on Bitlove">>},
- {'data-flattr-description', <<"Torrentification & Seeding">>},
- {'data-flattr-category', <<"rest">>},
- {'data-flattr-tags', <<"torrent,bittorrent,p2p,filesharing">>}
- ], <<"on Flattr">>}
- }
- ]}],
-
- {'div', [{class, <<"flattrdropdown">>},
- {title, <<"Support the podcaster and Bitlove">>},
- {'data-payment', [html:to_iolist(PaymentData1), html:to_iolist(PaymentData2)]}
- ], <<"Flattr ▾">>};
- true ->
- []
- end,
- {'div',
- [if
- Opts#render_opts.publisher ->
- {h3, [{class, "feed"}],
- [{a, [{href, ui_link:link_user_feed(User, Slug)}],
- [FeedTitle
- ]}
- ]};
- true ->
- []
- end,
- case Published of
+ {'div', [{class, <<"right">>}],
+ [case Published of
{{Y, Mo, D}, {H, M, _S}} ->
{p, [{class, "published"}],
[io_lib:format("~B-~2..0B-~2..0B",
@@ -221,6 +154,75 @@ render_item(Opts, #feed_item{user = User,
_ ->
[]
end,
+ if
+ Opts#render_opts.flattr ->
+ PaymentData1 =
+ if
+ is_binary(Payment),
+ size(Payment) > 0 ->
+ [{dl, [{class, <<"flattr">>}],
+ [{dt, [<<"Support ">>, User]},
+ {dd,
+ case Payment of
+ %% Transform an autosubmit link to Flattr button
+ <<"https://flattr.com/submit/auto?",
+ Payment1/binary>> ->
+ {a, [{class, <<"FlattrButton">>},
+ {href, Payment}
+ | [case K of
+ <<"user_id">> ->
+ {"data-flattr-uid", V};
+ _ ->
+ {"data-flattr-" ++ binary_to_list(K), V}
+ end
+ || {K, V} <- cowboy_http:x_www_form_urlencoded(
+ Payment1, fun cowboy_http:urldecode/1)
+ ]],
+ <<"Support the publisher">>};
+ _ ->
+ {a, [{href, Payment}],
+ Payment}
+ end}
+ ]}];
+ true ->
+ []
+ end,
+ PaymentData2 =
+ [{dl, [{class, <<"flattr">>}],
+ [{dt, <<"Support bitlove.org">>},
+ {dd,
+ {a, [{class, <<"FlattrButton">>},
+ {href, <<"https://flattr.com/profile/Astro">>},
+ {'data-flattr-url', <<(ui_link:base())/binary,
+ ItemLink/binary>>},
+ {'data-flattr-uid', <<"Astro">>},
+ {'data-flattr-title', <<"Torrent for ", Title/binary, " on Bitlove">>},
+ {'data-flattr-description', <<"Torrentification & Seeding">>},
+ {'data-flattr-category', <<"rest">>},
+ {'data-flattr-tags', <<"torrent,bittorrent,p2p,filesharing">>}
+ ], <<"on Flattr">>}
+ }
+ ]}],
+
+ {'div', [{class, <<"flattrdropdown">>},
+ {title, <<"Support the podcaster and Bitlove">>},
+ {'data-payment', [html:to_iolist(PaymentData1), html:to_iolist(PaymentData2)]}
+ ], <<"Flattr ▾">>};
+ true ->
+ []
+ end
+ ]},
+ {'div',
+ [if
+ Opts#render_opts.publisher ->
+ {h3, [{class, "feed"}],
+ [{a, [{href, ui_link:link_user_feed(User, Slug)}],
+ [FeedTitle
+ ]}
+ ]};
+ true ->
+ []
+ end,
{h3,
[{a, [{href, ItemLink}], Title}
Please sign in to comment.
Something went wrong with that request. Please try again.