示例#1
0
    def __init__ (self):

        super (ReportModal,self).__init__("reportModalContent.html")
        modalHeader = Elements ()
        modalHeader.append_to_element ("""
            <h3>Report</h3>
        """)
        self.add_header_content (modalHeader)

        modalBody = Elements ()
        modalBody.append_to_element ("""
            <form class="mail_form">
		    <label>
                        <span>Name: </span><input class="mail_form" id="report_form_name" type="text" name="name" />
		    </label><br/>
		    <label>
                        <span>Subject: </span><input ng-model="report_subject" class="mail_form" id="report_form_subject" type="text" name="subject" readonly />
		    </label><br/>

		    <label>
                        <span>Reason: </span><textarea class="mail_form" id="report_form_message" name="message"></textarea>
		    </label>
        </form>
        """)

        self.add_body_content (modalBody)

        modalFooter = Elements ()
               
        modalFooter.append_to_element ("""
            <button class="btn btn-primary" ng-click="send ()">Send</button>
            <button class="btn btn-warning" ng-click="cancel ()">Cancel</button>
        """)

        self.add_footer_content (modalFooter)
示例#2
0
    def __init__ (self):

        super (AdminProfileModal, self).__init__ ("adminProfileModalContent.html")
        modalHeader = Elements ()
        modalHeader.append_to_element ("""
            <h3>Profiles</h3>
        """)
        self.add_header_content (modalHeader)
        modalBody = Elements ()
        modalBody.append_to_element ("""
        <label for="name">Name: </label>
        <input id="name" class="form-control" type='text' ng-model='search_on.name'></input>
        <label for="email">Email: </label>
        <input id="email" class="form-control" type='text' ng-model='search_on.email'></input>        
        <label for="userid">UserId: </label>
        <input id="userid" class="form-control" type='text' ng-model='search_on.userid'></input>
        """)
        self.add_body_content (modalBody)
        modalFooter = Elements ()
        modalFooter.append_to_element ("""
        <button class="btn btn-primary" ng-click="adminprofile_modal_ok ()">Search</button>
        <button class="btn btn-warning" ng-click="adminprofile_modal_cancel ()">Close</button>
        <div>----------------------------------------------------------------</div>
        <div ng-repeat="user in received_profile_data.users">
            <ul>
                <li ng-repeat="(key, value) in user">{{ key }} : {{ value }}</li>
            </ul>
            <button ng-disabled="!user.banned" ng-click="adminprofile_modal_ban (user, false)">Unban</button>
            <button ng-disabled="user.banned" ng-click="adminprofile_modal_ban (user, true)">Ban</button>
            <div>----------------------------------------------------------------</div>
        </div>
        <div ng-if="received_profile_data.more">More</div>
        """)

        self.add_footer_content (modalFooter)
示例#3
0
    def __init__ (self, template_id):
        self.elements = Elements ()
        self.elements.open_element ("script", {"type":"text/ng-template", "id":template_id});
        
        self.header_contents = Elements ()
        self.header_contents.open_element ("div", {"class":"modal-header"})

        self.body_contents = Elements ()
        self.body_contents.open_element ("div", {"class":"modal-body"})

        self.footer_contents = Elements ()
        self.footer_contents.open_element ("div", {"class":"modal-footer"})
示例#4
0
    def __init__(self, title, attributes=None):
        """
            initializes the html doc string
            title - the doc title
            attributes - a dict to be turned into the attributes
            if a value is set to None then the attribute will be empty, however
            an empty string will be preserved as such
        """

        attribute_str = ""

        if attributes is not None:
            for k, v in attributes.iteritems():
                if v is not None:
                    attribute_str += ' {0}="{1}"'.format(k, v)
                else:
                    attribute_str += ' {0}'.format(k)

        self.html = """
            <!DOCTYPE html>
            <html {0}>
        """.format(attribute_str)

        self.head = """
                <head>
                    <title>{0}</title>
        """.format(title)

        self.elements = Elements()
        self.scripts = ""
        self.body = None
示例#5
0
    def __init__ (self, loggedin):

        super (MailModal,self).__init__("mailModalContent.html")
        modalHeader = Elements ()
        modalHeader.append_to_element ("""
            <h3>Contact Us</h3>
        """)
        self.add_header_content (modalHeader)

        if loggedin is not True:
            addr_field = """
		    <label>
                        <span>Email Address: </span><input class="mail_form" id="mail_form_email" type="text" name="email" />
		    </label><br/>
            """
        else:
            addr_field = ""

        
        modalBody = Elements ()
        modalBody.append_to_element ("""
            <form class="mail_form">
		    <label>
                        <span>Name: </span><input class="mail_form" id="mail_form_name" type="text" name="name" />
		    </label><br/>
                    {0}
		    <label>
                        <span>Subject: </span><input class="mail_form" id="mail_form_subject" type="text" name="subject" />
		    </label><br/>

		    <label>
                        <span>Message: </span><textarea class="mail_form" id="mail_form_message" name="message"></textarea>
		    </label>
        </form>
        """.format (addr_field))

        self.add_body_content (modalBody)

        modalFooter = Elements ()
               
        modalFooter.append_to_element ("""
            <button class="btn btn-primary" ng-click="send ()">Send</button>
            <button class="btn btn-warning" ng-click="cancel ()">Cancel</button>
        """)

        self.add_footer_content (modalFooter)
示例#6
0
    def __init__ (self):

        super (ProfileModal, self).__init__ ("profileModalContent.html")
        profileModalHeader = Elements ()
        profileModalHeader.append_to_element ("<h3>User Profile</h3>")
        self.add_header_content (profileModalHeader)
        profileModalBody = Elements ()
        profileModalBody.append_to_element ("""
            <ul>
                <li ng-repeat="(key, value) in profile_body_content">{{ key }} : {{ value }}</li>
            </ul>
        """)
        self.add_body_content (profileModalBody)
        profileModalFooter = Elements ()
        profileModalFooter.append_to_element ("""
            <button class="btn btn-primary" ng-click="ok ()">OK</button>
            <button class="btn btn-warning" ng-click="cancel ()">Cancel</button>""")
        self.add_footer_content (profileModalFooter)
示例#7
0
    def __init__ (self):

        super (HelpModal, self).__init__("helpModalContent.html")
        modalHeader = Elements ()
        modalHeader.append_to_element ("""
            <h3>Help</h3>
        """)
        self.add_header_content (modalHeader)

        modalBody = Elements ()
        modalBody.append_to_element ("""
            <ol class="help_list">
                <li class="help"><a href="#searching">Searching</a></li>
                    <ol class="help_list_inner">
                        <li class="help"><a href="#search_locality">Locality Field</a></li>
                        <li class="help"><a href="#search_terms">Search Terms</a></li>
                    </ol>
            </ol>
            <h2><a id="searching">Searching</a></h3>
            <p>The "Day Search" form is available whether you log in or not. The simplest search is to click the "Random Days"
                button. This will display a list of random results. Click on a title to see the day. You can return to the search
                by clicking the "Search Again" button or using the menu item, accessed by clicking your user name in the menu bar.
            </p>
            <h3><a id="search_locality">Locality</a></h4>
            <p>Enter the region you wish to search in the "Locality" field. It has autocomplete ability and will attempt to help 
                you find the region you're looking for. Locality is a requirement unless you are using the "Random Days" (which ignores all fields).
            </p>
            <h3><a id="search_terms">Search Terms</a></h4>
            <p>The "Search Terms" field allows you to narrow your search based on words potentially found in the description or title
                of a day. 
            </p>
        """)

        self.add_body_content (modalBody)

        modalFooter = Elements ()
               
        modalFooter.append_to_element ("""
            <button class="btn btn-warning" ng-click="close ()">Close</button>
        """)

        self.add_footer_content (modalFooter)
示例#8
0
    def __init__ (self):

        super (BecomeAContributorModal, self).__init__ ("becomeAContributorModalContent.html")

        logged_in, db_user = ADayThere.logged_in_user ()
        body_html = ""
        if logged_in:
            suggest_change = ""
            if db_user.name == db_user.email:
                suggest_change = """*Please, change your user name to something other then your email address to avoid spam.
                                Only alphanumeric characters and the underscore (_) are accepted."""

            if not logged_in:
                body_html += "You must be logged in through Google before becoming a contributor"
            else:
                body_html += """
                    <div>Thanks for choosing to become a contributor to the community. We ask that you don't use language that would make
                        anyone's Grandmother blush. Be repectful of others who use "A Day There". By clicking the OK button you agree
                        to allow "A Day There" to use the material you contribute and to abide by the rules.<br/><br/>
                        Thank You!<br/>
                    </div>
                    <div id="contributor_name_choice" style="color:red;">{0}</div>
                    <label for="contribute_google_nickname">Name:</label> 
                    <input data-warning-id="contributor_name_choice" id="contribute_google_nickname" class="form-control" type='text' contributor-user-name value="{1}"></input>
                    <input id="contribute_gotto_tools" type="checkbox">Go to create tools</input>
                """.format (suggest_change, db_user.name)

        modalHeader = Elements ()
        modalHeader.append_to_element ("""
            <h3>Become A Contributor</h3>
        """)
        self.add_header_content (modalHeader)
        modalBody = Elements ()
        modalBody.append_to_element (body_html)
        self.add_body_content (modalBody)
        modalFooter = Elements ()
        modalFooter.append_to_element ("""
            <button class="btn btn-primary" ng-click="contribute_modal_ok ()">OK</button>
            <button class="btn btn-warning" ng-click="contribute_modal_cancel ()">Cancel</button>""")
        self.add_footer_content (modalFooter)
示例#9
0
    def __init__ (self):

        super (AddPhotosModal, self).__init__ ("addPhotosModalContent.html")
        modalHeader = Elements ()
        modalHeader.append_to_element ("""
            <h3>Photos</h3>
        """)
        self.add_header_content (modalHeader)

        modalBody = Elements ()
        modalBody.append_to_element ("""
            <fieldset class="fieldset_box">
            <input type="button" value="Load Files From Disk" ng-click="open_file_selection()" class="btn btn-primary"/>
            <div collapse="false">
             <div  collapse="true" class= "well well-lg">
                <input id="open_file_selection" type="file" ng-model-instant id="photo_file_uploader" multiple onchange="angular.element (this).scope ().file_selection (this)"  accept="image/*" class="btn btn-warning" />
             </div>
             </fieldset>
             <fieldset class="fieldset_box">
             <div id="pic_loader_div">

             </div>
            </div>
            </fieldset>
        """)
        self.add_body_content (modalBody)
               
        modalFooter = Elements ()
        modalFooter.append_to_element ("""
            <button class="btn btn-primary" ng-click="remove_checked_photos ()">Remove Selected</button>
            <button class="btn btn-primary" ng-click="upload_checked_photos ()">Add Selected To Day</button>
            <button class="btn btn-warning" ng-click="addphotos_modal_close ()">Close</button>
            <div class="fieldset_box">
                <image id="pic_loader_hidden_image" style="display:none"></image>
                <p> {{ photo_storage.count }} photos stored<br/> {{ photo_storage.total_allowed }} allowed</p>
            </div>
        """)

        self.add_footer_content (modalFooter)
示例#10
0
    def __init__ (self):

        super (MarkerModal, self).__init__ ("markerModalContent.html")
        markerModalHeader = Elements ()
        markerModalHeader.append_to_element ("""
            <h1>Marker</h1>
        """)
        self.add_header_content (markerModalHeader)
        markerModalBody = Elements ()
        markerModalBody.append_to_element ("""
            <label for="marker_modal_title">Name</label> 
            <input id="marker_modal_title" class="form-control" type='text' ng-disabled="!marker_content.is_editable" ng-model='marker_content.name'></input>
            <label for="marker_modal_address">Address</label>
            <input id="marker_modal_address" class="form-control" type='text' ng-disabled="!marker_content.is_editable" ng-model='marker_content.vicinity'></input>
            <label for="marker_modal_own_comments">Comments</label>
            <textarea id="marker_modal_own_comments"  class="form-control" ng-disabled="!marker_content.is_editable" ng-model='marker_content.comment'></textarea>
        """)
        self.add_body_content (markerModalBody)
        markerModalFooter = Elements ()
        markerModalFooter.append_to_element ("""
            <button ng-show="show_add_button" class="btn btn-primary" ng-click="marker_modal_add_to_day (marker_content)">Add To Day</button>
            <button class="btn btn-primary" ng-click="marker_modal_ok ()">OK</button>
            <button class="btn btn-warning" ng-click="marker_modal_cancel ()">Cancel</button>""")
        self.add_footer_content (markerModalFooter)
示例#11
0
    def map_elements (cls, logged_in):
        element = Elements ()
        element.open_element ("section", {"id":"map_section"})\
            .close_element ("section")

        sidebarHeaderView = SidebarHeaderView ()
        mapSearchView = MapSearchView (logged_in)
        placesSearchView = PlacesSearchView (logged_in)
        markersView = MarkersView (logged_in)
        createADayView = CreateADayView (logged_in)
        myDaysView = MyDaysView (logged_in)
        toolHelpView = ToolHelpView (logged_in)

        profileModal = ProfileModal ()
        markerModal = MarkerModal ()
        addPhotosModal = AddPhotosModal ()
        helpModal = HelpModal ()
        mailModal = MailModal (logged_in)
        reportModal = ReportModal ()

        element.open_element ("section", {"id":"sidebar_section", "ng-controller":"sidebarCtrl"})\
            .open_element ("header", {"id":"sidebar_heading"})\
            .append_to_element (sidebarHeaderView.get ())\
            .close_element ("header")\
            .append_to_element ("<hr></hr>")\
            .open_element ("tabset", {"justified":"false"})\
            .open_element ("tab", {"heading":"Map Tools"})\
            .open_element ("accordion", {"close-others":"true"})\
            .open_element ("accordion-group",{"heading":"Location"})\
            .append_to_element (mapSearchView.get ())\
            .close_element ("accordion-group")\
            .open_element ("accordion-group", {"heading":"Places"})\
            .append_to_element (placesSearchView.get ())\
            .close_element ("accordion-group")\
            .open_element ("accordion-group", {"heading":"Markers"})\
            .append_to_element (markersView.get ())\
            .close_element ("accordion-group")\
            .close_element ("accordion")\
            .close_element ("tab")\
            .open_element ("tab", {"heading":"Create Day"})\
            .append_to_element (createADayView.get ())\
            .close_element ("tab")\
            .open_element ("tab", {"active":"find_a_day.active", "heading":"My Days"})\
            .append_to_element (myDaysView.get ())\
            .close_element ("tab")\
            .open_element ("tab", {"heading":"Help"})\
            .append_to_element (toolHelpView.get ())\
            .close_element ("tab")\
            .close_element ("tabset")\
            .open_element ("div", {"ng-controller":"profileCtrl"})\
            .append_to_element (profileModal.get ())\
            .close_element ("div")\
            .open_element ("div")\
            .append_to_element (markerModal.get ())\
            .close_element ("div")\
            .open_element ("div")\
            .append_to_element (addPhotosModal.get ())\
            .close_element ("div")\
            .open_element ("div")\
            .append_to_element (helpModal.get ())\
            .close_element ("div")\
            .open_element ("div")\
            .append_to_element (mailModal.get ())\
            .close_element ("div")\
            .open_element ("div")\
            .append_to_element (reportModal.get ())\
            .close_element ("div")\
            .close_element ("section")
        return element
示例#12
0
class Html5Document:

    def __init__(self, title, attributes=None):
        """
            initializes the html doc string
            title - the doc title
            attributes - a dict to be turned into the attributes
            if a value is set to None then the attribute will be empty, however
            an empty string will be preserved as such
        """

        attribute_str = ""

        if attributes is not None:
            for k, v in attributes.iteritems():
                if v is not None:
                    attribute_str += ' {0}="{1}"'.format(k, v)
                else:
                    attribute_str += ' {0}'.format(k)

        self.html = """
            <!DOCTYPE html>
            <html {0}>
        """.format(attribute_str)

        self.head = """
                <head>
                    <title>{0}</title>
        """.format(title)

        self.elements = Elements()
        self.scripts = ""
        self.body = None


    def add_meta_tags(self, tags):
        """
            tags - a list of dicts to be turned into meta tags
            i.e. [{"name":"description", "content":"Helo World"}, {"charset":"UTF-8"}]
            if a value is set to None then the attribute will be empty, however
            an empty string will be preserved as such
        """

        for tag in tags:
            self.head += """
                    <meta """

            for k, v in tag.iteritems():
                if v is not None:
                    self.head += ' {0}="{1}"'.format(k, v)
                else :
                    self.head += ' {0}'.format(k)
            self.head += ">"

        return self


    def add_links(self, links):
        """
            a list of dicts to be turned into link tags
            i.e. [{"rel":"stylesheet", "href":"css/main.css"}, {"rel":"stylesheet", "type":"text/css", "href":"theme.css"}]
            if a value is set to None then the attribute will be empty, however
            an empty string will be preserved as such
        """

        for link in links:
            self.head += """
                    <link """

            for k, v in link.iteritems():
                if v is not None:
                    self.head += ' {0}="{1}"'.format(k, v)
                else :
                    self.head += ' {0}'.format(k)
            self.head += ">"

        return self


    def add_script_tags_for_head(self, scripts):
        """
            a list of dicts to be turned into script tags
            i.e. [{"src":"js/vendor/modernizr-2.7.1.min.js"}]
            if a value is set to None then the attribute will be empty, however
            an empty string will be preserved as such
        """

        for script in scripts:
            self.head += """
                    <script """

            for k, v in script.iteritems():
                if v is not None:
                    self.head += ' {0}="{1}"'.format(k, v)
                else :
                    self.head += ' {0}'.format(k)
            self.head += "></script>"

        return self


    def add_script_tags_for_body(self, scripts):
        """
            a list of dicts to be turned into script tags
            i.e. [{"src":"js/vendor/modernizr-2.7.1.min.js"}]
            if a value is set to None then the attribute will be empty, however
            an empty string will be preserved as such
        """
        self.scripts = ""

        for script in scripts:
            self.scripts += """
                    <script """

            for k, v in script.iteritems():
                if v is not None:
                    self.scripts += ' {0}="{1}"'.format(k, v)
                else :
                    self.scripts += ' {0}'.format(k)
            self.scripts += "></script>"

        return self


    def add_attributes_to_body(self, attributes):
        """
            attribute - a dict of attributes to be added to the body tag
        """

        attribute_str = ""

        if attributes is not None:
            for k, v in attributes.iteritems():
                if v is not None:
                    attribute_str += ' {0}="{1}"'.format(k, v)
                else :
                    attribute_str += ' {0}'.format(k)

        self.body = """
            <body{0}>""".format(attribute_str)


    def open_element(self, tag, attributes=None, text=""):

        self.elements.open_element(tag, attributes, text)
        return self

    def append_to_element(self, text):

        self.elements.append_to_element(text)
        return self


    def close_element(self, tag):

        self.elements.close_element(tag)
        return self


    def __shiv(self):

        self.head += """
                <!--[if lt IE 9]>
                    <script src="js/html5shiv.js"></script>
                    <script src="js/respond.min.js"></script>
                <![endif]-->
        """


    def get(self):
        """
            returns the html document
        """

        self.__shiv()

        if self.body is None:
            self.body = """
            <body>
            """

        self.html += self.head
        self.html += """
            </head>
        """
        self.html += self.body
        self.html += self.elements.get()
        self.html += self.scripts
        self.html += """
            </body>
        """
        self.html += """
        </html>
        """

        return self.html
示例#13
0
    def __init__ (self, logged_in):
        if logged_in:
            element = Elements () 
            element.open_element ("accordion", {"close-others":"true"})
            
            element.open_element ("accordion-group",{"heading":"Saved Days", "is-open":"true"})
            element.append_to_element ("""
                <div class="ng-cloak" ng-show='my_days.length > 0'><input id="my_days_expander" type='button' value="Expand All" ng-click='my_days_expand ()'></input></div>
                <li ng-repeat="day in my_days">
                    <a ng-click="my_day_toggle_open (day)">{{ day.title }}</a>
                    <button type="button" ng-click="delete_day (day)">Delete</button>
                    <div collapse="day.is_collapsed">
                        <div class="well well-lg">
                            <label>Locality: {{ day.full_locality }} </label><br>
                            <label for="day_keywords">Keywords</label>
                            <input id="day_keywords" class="form-control" type='text' ng-disabled="true" ng-model='day.keywords'></input>
                            <label for="day_description">Description</label>
                            <input id="day_description" class="form-control" type='text' ng-disabled="!day_is_editable (day)" ng-model='day.description'></input>
            """)

            dayview_places = DayViewPlaces ("day")
            element.append_to_element (dayview_places.get ())
            dayview_photos = DayViewPhotos ("day")
            element.append_to_element (dayview_photos.get ())

            element.append_to_element ("""
                            <button type="button" ng-disabled="day_is_editable (day)" ng-click="set_day_editable (day, $index)">Edit</button>
                            <button type="button" ng-disabled="!day_is_editable (day)" ng-click="save_modified_day (day)">Save</button>
                            <button type="button" ng-disabled="day_is_editable (day)" ng-click="copy_day_as (day)">Copy As</button>
                            <button type="button" ng-disabled="!day_is_editable (day)" ng-click="cancel_changes_to_day (day)">Cancel</button>
                            <input id="display_day_view_button_{{ $index }}" type="button" ng-click="display_day_view (day, $index)" value="Display"></input>
                            <select ng-model="direction_mode[$index]" ng-options="mode for mode in direction_modes">
                            </select>
                        </div> 
                    </div>
                </li>
            """)
            element.close_element ("accordion-group")
            
            element.open_element ("accordion-group",{"heading":"Deleted Days", "is-open":"false"})
            element.append_to_element ("""
                    <div class="ng-cloak" ng-show='my_deleted_days.length > 0'>
                        <input id="my_deleted_days_expander" type='button' value="Expand All" ng-click='my_deleted_days_expand ()'></input>
                    </div>
                    <li ng-repeat="day in my_deleted_days">
                        <a ng-click="my_day_toggle_open (day)">{{ day.title }}</a>
                        <button type="button" ng-click="restore_day (day)">Restore</button>
                        <div collapse="day.is_collapsed">
                            <div class="well well-lg">
                                <label>Locality: {{ day.full_locality }} </label><br>
                                <label for="deleted_day_keywords">Keywords</label>
                                <input id="deleted_day_keywords" class="form-control" type='text' ng-disabled="true" ng-model='day.keywords'></input>
                                <label for="deleted_day_description">Description</label>
                                <input id="deleted_day_description" class="form-control" type='text' ng-disabled="!day_is_editable (day)" ng-model='day.description'></input>
            """)

            dayview_places = DayViewPlaces ("day")
            element.append_to_element (dayview_places.get ())
            dayview_photos = DayViewPhotos ("day")
            element.append_to_element (dayview_photos.get ())
            
            element.append_to_element ("""
                                <input id="display_day_view_button_{{ $index }}" type="button" ng-click="display_day_view (day, $index)" value="Display"></input>
                                <select ng-model="direction_mode[$index]" ng-options="mode for mode in direction_modes">
                                </select>
                            </div> 
                        </div>
                    </li>
            """)
            element.close_element ("accordion-group")
            element.close_element ("accordion")

            self.html = element.get ()
        else:
            self.html = """
示例#14
0
    def get_days_display (self):
        elements = Elements ();
        elements.open_element ("div", { "id":"daysearch_return_display" })
        elements.append_to_element ("""<h1 class="heading_font">{{ daysearch_returned.msg_to_user }}</h1>""")
        elements.open_element ("li", { "ng-repeat":"day in daysearch_returned.days" });
        elements.append_to_element ("""
                    <a ng-click="day_toggle_open (day)">{{ day.title }}</a>
                    <p>{{ day.description }}</p>
                    <div collapse="day.is_collapsed">
                        <div class="well well-lg">
                            <div class="g-plus" data-action="share" data-href="//www.adaythere.com/locality_days?user_id={{ day.userid }}&title={{ day.title }}></div>
                            <label>Locality: {{ day.full_locality }} </label><br>
                            <label for="day_keywords">Keywords</label>
                            <input id="day_keywords" class="form-control" type='text' ng-disabled="true" ng-model='day.keywords'></input>
                            <label for="day_description">Description</label>
                            <input id="day_description" class="form-control" type='text' ng-disabled="!day_is_editable (day)" ng-model='day.description'></input>
        """)

        dayview_places = DayViewPlaces ("day")
        elements.append_to_element (dayview_places.get ())
        dayview_photos = DayViewPhotos ("day")
        elements.append_to_element (dayview_photos.get ())

        elements.append_to_element ("""
            <p>Posted by: {{ day.name }} </p>
            Number of reviews: {{day.numberOfReviews}} - Average review: <rating readonly="true" value="day.averageReview" max="10"></rating>
            <a ng-click="show_reviews_for ($index)" style="float: right;">Reviews</a>
            <br>
            <div id="daysearch_review_display_window{{$index}}" ng-show="show_review_display[$index]" class="review_display" >
                <div ng-repeat="review in daysearch_returned.reviews[$index]" ng-style="{'background-color':'#D8D8D8'}">
                    <p>Posted by: {{ review.commenters_name }}</p>
                    <rating readonly="true" value="review.rating" max="10"></rating><br/>
                    <p>{{ review.text }}
                    <a href ng-click="execute_report_function ('review', review)" tooltip-placement="bottom" tooltip="Report" tooltip-trigger="mouseenter" style="float:right;">&#8709;</a>
                </div>
            </div>
            <button id="dayssearch_show_map_button{{$index}}" type="button" ng-click="show_map_of (day, $index)">View Map</button>
            <button ng-click="open_google_plus_window (day.userid, day.title)">Share
                <img src="https://www.gstatic.com/images/icons/gplus-16.png" alt="Share on Google+"/>
            </button>
        """)

        dayview_rater = DayViewRater ("day")
        elements.append_to_element (dayview_rater.get ())

        elements.append_to_element ("""
                        <select id="daysearch_travelmode_selector{{$index}}" ng-model="direction_mode[$index]" ng-options="mode for mode in direction_modes" style="display:none">
                        </select>

                        <div id="googlemap_of_{{$index}}"><div>
                        </div> 
                    </div>
        """)
        elements.close_element ("li");
        elements.append_to_element ("""
            <button type="button" ng-click="return_to_daysearch ()">Search Again</button>
        """);
        elements.close_element ("div");
        
        return elements.get ()
示例#15
0
class Modal (object):

    def __init__ (self, template_id):
        self.elements = Elements ()
        self.elements.open_element ("script", {"type":"text/ng-template", "id":template_id});
        
        self.header_contents = Elements ()
        self.header_contents.open_element ("div", {"class":"modal-header"})

        self.body_contents = Elements ()
        self.body_contents.open_element ("div", {"class":"modal-body"})

        self.footer_contents = Elements ()
        self.footer_contents.open_element ("div", {"class":"modal-footer"})
        

    def add_header_content (self, elements):
        self.header_contents.append_to_element (elements.get ())

    def add_body_content (self, elements):
        self.body_contents.append_to_element (elements.get ())

    def add_footer_content (self, elements):
        self.footer_contents.append_to_element (elements.get ())


    def get (self):
        self.header_contents.close_element ("div")
        self.body_contents.close_element ("div")
        self.footer_contents.close_element ("div")

        self.elements.append_to_element (self.header_contents.get ())
        self.elements.append_to_element (self.body_contents.get ())
        self.elements.append_to_element (self.footer_contents.get ())

        self.elements.close_element ("script")

        return self.elements.get ()