Просмотр исходного кода

More user-friendly branch names

Michelle Rossouw 3 лет назад
Родитель
Сommit
90206bee92
3 измененных файлов с 10 добавлено и 4 удалено
  1. 7 1
      app.py
  2. 2 2
      templates/index.html
  3. 1 1
      templates/index2.html

+ 7 - 1
app.py

@@ -24,7 +24,12 @@ appdir = os.path.dirname(__file__)
 VEHICLES = [ 'Copter', 'Plane', 'Rover', 'Sub', 'Tracker', 'Blimp', 'Heli']
 default_vehicle = 'Copter'
 chosen_vehicle = default_vehicle
-BRANCHES = ['upstream/master', 'upstream/Plane-4.2', 'upstream/Copter-4.2', 'upstream/Rover-4.2']
+BRANCHES = {
+    'upstream/master' : 'Latest',
+    'upstream/Plane-4.2' : 'Plane 4.2 stable',
+    'upstream/Copter-4.2' : 'Copter 4.2 stable',
+    'upstream/Rover-4.2' : 'Rover 4.2 stable'
+}
 default_branch = 'upstream/master'
 chosen_branch = default_branch
 
@@ -538,6 +543,7 @@ def home2():
                            get_boards=get_boards,
                            chosen_vehicle=chosen_vehicle,
                            chosen_branch=chosen_branch,
+                           get_branches=get_branches,
                            get_build_options=lambda x : get_build_options(BUILD_OPTIONS, x),
                            get_build_categories=lambda : get_build_categories(BUILD_OPTIONS))
 

+ 2 - 2
templates/index.html

@@ -42,9 +42,9 @@
                 <select name="branch">
                     {% for branch in get_branches()[0] %}
                     {% if branches == get_branches()[1] %}
-                    <option value="{{branch}}" selected>{{branch}}</option>
+                    <option value="{{branch}}" selected>{{get_branches()[0][branch]}}</option>
                     {% else %}
-                    <option value="{{branch}}">{{branch}}</option>
+                    <option value="{{branch}}">{{get_branches()[0][branch]}}</option>
                     {% endif %}
                     {% endfor %}
                 </select>

+ 1 - 1
templates/index2.html

@@ -35,7 +35,7 @@
         <h2>ArduPilot Custom Firmware Builder</h2>
         <br><b>This site is EXPERIMENTAL</b>
 
-        <p>Branch: {{chosen_branch}} <br>
+        <p>Branch: {{get_branches()[0][chosen_branch]}} <br>
         Vehicle: {{chosen_vehicle}}</p>
         <p>Please select the required options for the custom firmware build, then hit 'Generate'.</p>