{{#Name=Button Actions}} {{#Description=Adds buttons with actions, displayed horizontally or vertically}} {{#Version=1.0}} {{#Author=HomeSeer}} {{#CanBeDeleted=False}} {{#SaveList=}} {{includefileraw Dashboards/Cards/Custom/Common/CommonHeader.html}} {{# To simplify custom controls, the settings dialog that holds settings is auto generated }} {{# To have your persistent settings saved and restored automatically, add them below in the section that calls "get_value" }} {{sections[index]="Settings"}} {{layout_vertical= get_value 'save_layout_vertical' '' 'Layout Vertical' 'toggle'}} {{max_buttons_text= get_value 'save_max_buttons' '5' 'Max Buttons' 'text'}} {{if max_buttons_text==''}}{{max_buttons_text='5'}}{{end}} {{max_buttons=string.to_int max_buttons_text}} {{padding_top= get_value 'save_padding_top' '0' 'Top Padding' 'text'}} {{sections[index]="Button"}} {{button_width= get_value 'save_button_width' '' 'Width' 'text'}} {{button_height= get_value 'save_button_height' '12' 'Height' 'text'}} {{button_text_size= get_value 'save_button_text_size' '12' 'Text Size' 'text'}} {{text_color= get_value 'save_text_color' '#FFFFFF' 'Text Color' 'color'}} {{button_bold= get_value 'save_button_bold' '' 'Text Bold' 'toggle'}} {{button_background_color= get_value 'save_background_button_color' '#329de4' 'Background Color' 'color'}} {{button_background_image = get_saved_value 'save_button_background_image' widget_id}} {{labels=[]}} {{actions=[]}} {{dashboards=[]}} {{event_list=[]}} {{#event ref ID}} {{url_list=[]}} {{newtab_list=[]}} {{for index in 0..max_buttons}} {{label_temp=get_saved_value ('save_label' | string.append index) widget_id}} {{if label_temp==''}}{{break}}{{end}} {{labels[index]=label_temp}} {{actions[index]=get_saved_value ('save_action' | string.append index) widget_id}} {{dashboards[index]=get_saved_value ('save_dashboard' | string.append index) widget_id}} {{event_list[index]=get_saved_value ('save_event' | string.append index) widget_id}} {{url_list[index]=get_saved_value ('save_url' | string.append index) widget_id}} {{newtab_list[index]=get_saved_value ('save_newtab' | string.append index) widget_id}} {{end}} {{if (array.size labels)==0}} {{#none defined, add one}} {{labels[0]='Change Me'}} {{actions[0]="1"}} {{end}} {{# normal display HTML is here. This is what is displayed when viewing the card in non-edit mode}} {{if button_width !='' }} {{include_button_size=true}} {{else}} {{include_button_size=false}} {{end}}
{{if layout_vertical=="on"}}
{{else}}
{{end}} {{for index in 0..(max_buttons-1)}} {{if layout_vertical=="on"}}
{{end}} {{if actions[index]=='1'}} {{end}} {{if actions[index]=='2'}} {{end}} {{if actions[index]=='3'}} {{if newtab_list[index]=='on'}} {{else}} {{end}} {{end}} {{if layout_vertical=="on"}}
{{end}} {{end}}
{{#if we are not in edit mode, don't bother including the edit mode content}} {{if dbs.edit_mode}} {{# card settings dialog, the second tab autogenerates settings based on values added to the settings arrays. Custom settings HTML can be added}} {{#this dialog has 2 tabs, one for formatting the card, the other for card content}} {{# w=widget class, dashboard=dashboard name, d=device}}
{{includefileraw Dashboards/Cards/Custom/Common/CommonScript.html}} {{else}} {{end}}