summary refs log tree commit diff
path: root/webclient/home/home.html
blob: 49eb56a602805e5995d7c16e2d37bb49190eff21 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<div ng-controller="HomeController" data-ng-init="onInit()">

    <div id="page">
    <div id="wrapper">
        
    <div>
        <form>
            <table>
                <tr>
                    <td>
                        <div class="profile-avatar">
                            <img ng-src="{{ config.avatarUrl || 'img/default-profile.jpg' }}"/>
                        </div>
                    </td>
                    <td>
                        <div id="user-ids">
                            <div id="user-displayname">{{ config.displayName }}</div>
                            <div>{{ config.user_id }}</div>                        
                        </div>
                    </td>
                </tr>
            </table>
        </form>
    </div>
    
    <h3>Recents</h3>

    <div class="recentsTableWrapper">
    <table class="recentsTable">
        <tbody ng-repeat="(rm_id, room) in rooms" ng-click="goToPage('room/' + (room.room_alias ? room.room_alias : rm_id) )" class ="recentsRoom" >
            <tr>
                <td class="recentsRoomName">
                    {{ room.room_display_name }}
                </td>
                <td class="recentsRoomSummaryTS">
                    {{ (room.lastMsg.ts) | date:'MMM d HH:mm' }}
                </td>
            </tr>

            <tr>
                <td colspan="2" class="recentsRoomSummary">

                    <div ng-show="room.membership === 'invite'" >
                        {{ room.inviter }} invited you
                    </div>

                    <div ng-hide="room.membership === 'invite'" ng-switch="room.lastMsg.type" >
                         <div ng-switch-when="m.room.member">
                            {{ room.lastMsg.user_id }}
                            {{ {"join": "joined", "leave": "left", "invite": "invited"}[room.lastMsg.content.membership] }}
                            {{ room.lastMsg.content.membership === "invite" ? (room.lastMsg.state_key || '') : '' }}
                        </div>

                        <div ng-switch-when="m.room.message">
                            <div ng-switch="room.lastMsg.content.msgtype">
                                <div ng-switch-when="m.text">
                                    {{ room.lastMsg.user_id }} :
                                    <span ng-bind-html="(room.lastMsg.content.body) | linky:'_blank'">
                                    </span>
                                </div>

                                <div ng-switch-when="m.image">
                                    {{ room.lastMsg.user_id }} sent an image
                                </div>

                                <div ng-switch-default>
                                    {{ room.lastMsg.content }}
                                </div>
                            </div>
                        </div>

                        <div ng-switch-default>
                            {{ room.lastMsg }}
                        </div>
                    </div>
                </td>
            </tr>
        </tbody>
    </table>
    <br/>

    <h3>Public rooms</h3>
    
    <div class="public_rooms" ng-repeat="room in public_rooms">
        <div>
            <a href="#/room/{{ room.room_alias ? room.room_alias : room.room_id }}" >{{ room.room_alias }}</a>
        </div>
    </div>
    <br/>
    
    <div>
        <form>
            <input size="40" ng-model="newRoom.room_id" ng-enter="createNewRoom(newRoom.room_id, newRoom.private)" placeholder="(e.g. foo_channel)"/>
            <input type="checkbox" ng-model="newRoom.private">private
            <button ng-disabled="!newRoom.room_id" ng-click="createNewRoom(newRoom.room_id, newRoom.private)">Create room</button>    
        </form>
    </div>
    <div>
        <form>
            <input size="40" ng-model="joinAlias.room_alias" ng-enter="joinAlias(joinAlias.room_alias)" placeholder="(e.g. #foo_channel:example.org)"/>
            <button ng-disabled="!joinAlias.room_alias" ng-click="joinAlias(joinAlias.room_alias)">Join room</button>    
        </form>
    </div>
    <br/>
    
    {{ feedback }}

    </div>    
    </div>
</div>