Skip to content

Commit

Permalink
Improved code
Browse files Browse the repository at this point in the history
  • Loading branch information
teusbenschop committed Mar 5, 2024
1 parent 44d97e9 commit c090380
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
13 changes: 5 additions & 8 deletions editor/style.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@
#include <webserver/request.h>
#include <editor/styles.h>
#include <access/bible.h>
using namespace std;


string editor_style_url ()
std::string editor_style_url ()
{
return "editor/style";
}
Expand All @@ -37,26 +36,24 @@ bool editor_style_acl (Webserver_Request& webserver_request)
{
if (Filter_Roles::access_control (webserver_request, Filter_Roles::translator ()))
return true;
auto [ read, write ] = access_bible::any (webserver_request);
const auto [ read, write ] = access_bible::any (webserver_request);
return read;
}


string editor_style (Webserver_Request& webserver_request)
std::string editor_style (Webserver_Request& webserver_request)
{
if (webserver_request.query.count ("style")) {
string style = webserver_request.query["style"];
const std::string style = webserver_request.query["style"];
Editor_Styles::recordUsage (webserver_request, style);
string action = Editor_Styles::getAction (webserver_request, style);
const std::string action = Editor_Styles::getAction (webserver_request, style);
return style + "\n" + action;
}


if (webserver_request.query.count ("all")) {
return Editor_Styles::getAll (webserver_request);
}


return Editor_Styles::getRecentlyUsed (webserver_request);
}

3 changes: 2 additions & 1 deletion editor/styles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,12 @@ std::string Editor_Styles::getAll (Webserver_Request& webserver_request)
for (const auto& item : data) {
const std::string& marker = item.first;
std::string name = item.second;
name = translate (name); // Todo check this.
name = translate (name);
Database_Styles_Item marker_data = webserver_request.database_styles()->getMarkerData (stylesheet, marker);
std::string category = marker_data.category;
category = styles_logic_category_text (category);
const std::string line2 = marker + " " + name + " (" + category + ")";
std::cout << line2 << std::endl; // Todo
lines.push_back ("<option>" + line2 + "</option>");
}

Expand Down

0 comments on commit c090380

Please sign in to comment.