Skip to content

Commit

Permalink
Improve file share example UI
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffail committed Apr 26, 2015
1 parent e72ee7f commit 382d01e
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 12 deletions.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ help:
@echo ""
@echo " make clean : Clean the repository of any built/generated files"


build: check
@mkdir -p $(JS_BIN)
@echo ""; echo " -- Building $(BIN)/$(PROJECT) -- ";
Expand Down
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ To read more and find examples check out the wiki: [leaps wiki](https://github.c
Leaps is a single binary, with no runtime dependencies, everything is set through a single config file. Just download a release package for your OS and do the following to run an example:

```bash
tar -xvf ./leaps-linux_amd64-v0.1.2.tar.gz
tar -xvf ./leaps-linux_amd64-v0.4.0.tar.gz
cd leaps
./bin/leaps -c ./config/leaps_example.yaml
```
Expand All @@ -27,6 +27,8 @@ To generate a configuration file of all default values:
./bin/leaps --print-yaml
```

For a cooler example check out the [website](https://jeffail.github.io/leaps)

##Customizing your service

There are lots of example configuration files in ./config to check out for various use cases.
Expand Down Expand Up @@ -95,12 +97,14 @@ To build and then start up an example server do the following:
go get github.com/jeffail/leaps
cd $GOPATH/src/github.com/jeffail/leaps

# To build the binary and client libraries:
make build
./bin/leaps -c ./config/leaps_example.yaml
```

Or, to simply build the service binary on its own is just:

# Or, to build only the service binary:
go build
```bash
go get github.com/jeffail/leaps
```

For more build options call `make help`.
Expand Down
Binary file modified static/share_dir/leaps_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions static/share_dir/leapshare.js
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ var create_path_click = function(ele, id) {
current_ele.className = fileItemClass;
}
ele.className = fileItemClass + ' selected';
window.location.hash = "path:" + id;
join_new_document(id);
}
};
Expand Down Expand Up @@ -546,6 +547,16 @@ var get_paths = function() {
});
};

// Use to alert users when new messages appear
var flash_chat_window = function() {
var info_window = document.getElementById("info-window");
info_window.style.boxShadow = "0px 0px 0px 5px #4E81B4";

setTimeout(function() {
info_window.style.boxShadow = "0px 0px 0px 0px #4E81B4";
}, 300);
};

var chat_message = function(user_id, username, message) {
var container = document.getElementById("info-window");
var messages = document.getElementById("info-messages");
Expand Down Expand Up @@ -589,6 +600,8 @@ var chat_message = function(user_id, username, message) {

messages.appendChild(div);
container.scrollTop = container.scrollHeight;

flash_chat_window();
};

var system_message = function(text, style) {
Expand All @@ -603,6 +616,8 @@ var system_message = function(text, style) {
div.appendChild(textNode);
messages.appendChild(div);
container.scrollTop = container.scrollHeight;

flash_chat_window();
};

var set_cookie_option = function(key, value) {
Expand Down Expand Up @@ -742,13 +757,24 @@ window.onload = function() {
chat_bar.focus();
};

/* We're using our own implementation of usernames by sending JSON objects in leaps messages,
* so to keep all clients up to date across name changes lets just send it every second. It's a
* painless job so why not?
*/
setInterval(function() {
if ( leaps_client !== null ) {
leaps_client.send_message(JSON.stringify({
username: username
}));
}
}, 1000);

// You can link directly to a filepath with <URL>#path:/this/is/the/path.go
if ( window.location.hash.length > 0 &&
window.location.hash.substr(1, 5) === "path:" ) {
var path = window.location.hash.substr(6);
join_new_document(path);
}
};

})();
10 changes: 3 additions & 7 deletions static/share_dir/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ h1, h2, h3, h4, h5, button, strong, .button, .round-button {
}

.logo {
height: 40px;
height: 100%;
padding: 0px;
margin: 5px 0 0 30px;
margin: 0 0 0 20px;
}

.directory-name {
Expand Down Expand Up @@ -303,6 +303,7 @@ h1, h2, h3, h4, h5, button, strong, .button, .round-button {
#info-window {
right: 0;
bottom: 0;
transition: box-shadow .25s ease-in-out;
}

#file-list-container {
Expand All @@ -326,11 +327,6 @@ h1, h2, h3, h4, h5, button, strong, .button, .round-button {
left: 16vw;
}

#chat-bar-container {
right: 10px;
bottom: 10px;
}

#chat-bar {
width: 80px;
width: 10vw;
Expand Down

0 comments on commit 382d01e

Please sign in to comment.