Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add input fields that allow the user to assign values to various parameters #115

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/GUI_draft/static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
#
*/

.input_field_labels {
font-size: 18px;
}

.progression_bar_buttons {
background-color: #eb5e0b;
color: white;
Expand Down
1 change: 1 addition & 0 deletions src/GUI_draft/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
crossorigin="anonymous" />
<link rel="shortcut icon" href="{{ url_for('static', path='favicon/favicon.ico') }}">
<link rel="stylesheet" href="{{ url_for('static', path='css/style.css') }}">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

</head>

Expand Down
32 changes: 32 additions & 0 deletions src/GUI_draft/templates/create_project.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
<!-- WRITE HTML CODE WITHIN THESE block content TAGS -->
{% block content %}

{% set project_parameters={
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the structure should be a list of dicts (you can move the name inside with the key name or label for example

'Project Name': {'value': '', 'default_value': 'Berlin Energy Cell', 'type': 'str', 'description': 'Name of the project, defined by user', 'unit': None, 'restrictions': None, 'docs_link': '#' },
'Project Id': {'value': '', 'default_value': 'proj_3_2', 'type': 'str', 'description': 'ID for project, assigned by user', 'unit': None, 'restrictions': None, 'docs_link': '#' },
'Country': {'value': '', 'default_value': 'Germany', 'type': 'str', 'description': 'Country where the project is located', 'unit': None, 'restrictions': None, 'docs_link': '#' },
'Project Duration': {'value': '', 'default_value': '1', 'type': 'float', 'description': 'Number of years for which the energy system is simulated', 'unit': 'Years', 'restrictions': 'A whole or decimal point number', 'docs_link': '#' },
} %}

{% set by_default = 0 %}

<div class="grid-x">

<div class="cell small-9 grid-x box comment">
Expand All @@ -23,6 +32,29 @@ <h4 class="cell"><a href="https://open-plan.readthedocs.io/en/latest/tool_interf
<input type="file" id="projParamsFile" class="show-for-sr">
</div>
<p class="cell">A list of inputs relevant for the project should be listed here</p>
<form class="cell small-9 grid-x">
{% for (param, param_details) in project_parameters.items() %}
<div class="cell grid-x">
<label class="cell small-6 input_field_labels">{{ param }}</label>
{% for (param_info, value) in param_details.items() %}
{% if param_info == 'docs_link' %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you loop here, you can assess the value directly with param_details["docs_link"]

<a class="cell auto" href="{{ value }}" target="_blank"><i class="fa fa-question-circle"></i></a>
{% endif %}
{% endfor %}
</div>
<div class="cell grid-x">
{% for (param_info, value) in param_details.items() %}
{% if param_info == 'type' and value == 'str' %}
{% set param_type = "text" %}
{% elif param_info == 'type' and value == 'float' %}
{% set param_type = "number" %}
{% endif %}
{% endfor %}
<input class="cell auto" type="{{ param_type }}" placeholder="{{ project_parameters[param.default_value] }}">
<p class="cell auto">{{ project_parameters[param]['unit'] }}</p>
</div>
{% endfor %}
</form>
</div>

<div class="cell auto view-component" title="Project Location">
Expand Down